Last active
August 29, 2015 14:13
-
-
Save nijjwal/dc51a41f8f1d1021dba2 to your computer and use it in GitHub Desktop.
Functions.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
public class Functions { | |
/** | |
* Display invalid numbers in a given array that are not the multiples of the key parameter. | |
* @param key Enter a number whose multiple you want to find | |
* @param array Enter the array which you want to check for invalid numbers | |
* @return | |
* @return array Returns an array of invalid characters | |
*/ | |
public ArrayList<Integer> Multiplesofanumber(int key, int[] array) | |
{ | |
//create a dynamic array | |
ArrayList<Integer> result; | |
result = new ArrayList<Integer>(); | |
for(int i=0; i < array.length; i++) | |
{ | |
if(array[i]%key !=0) | |
{ | |
result.add(array[i]); | |
} | |
} | |
return result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment