Skip to content

Instantly share code, notes, and snippets.

@nijjwal
Last active August 29, 2015 14:13
Show Gist options
  • Save nijjwal/dc51a41f8f1d1021dba2 to your computer and use it in GitHub Desktop.
Save nijjwal/dc51a41f8f1d1021dba2 to your computer and use it in GitHub Desktop.
Functions.java
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