|
|
@ -0,0 +1,23 @@ |
|
|
|
public class doubleTest { |
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
System.out.println(containsMultipleOf(new int[] {}, 2)); |
|
|
|
System.out.println(containsMultipleOf(new int[] { 1, 1, 1 }, 2)); |
|
|
|
System.out.println(containsMultipleOf(new int[] { 1, 1, 3 }, 3)); |
|
|
|
System.out.println(containsMultipleOf(new int[] { -1, -2, -3 }, 1)); |
|
|
|
} |
|
|
|
|
|
|
|
public static boolean containsMultipleOf(int[] x, int base) { |
|
|
|
int counter = 0; |
|
|
|
for (int i = 0; i < x.length; i++) { |
|
|
|
if (x[i] / base != 0) { |
|
|
|
counter++; |
|
|
|
} |
|
|
|
} |
|
|
|
if (counter > 0) { |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |