Browse Source

added DoubleTest.java

master
Alexander Wehde 3 years ago
parent
commit
2cab92f584
  1. 23
      doubleTest.java

23
doubleTest.java

@ -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;
}
}
}
Loading…
Cancel
Save