I'm trying to get my Array with ramdom numbers to Comparer the 10 first digtes and tell what if it's higher, lower or equel to the 11th number, i have tried alot of loops and many other things, but im stuck at this point.
private static int[] anArray;
public static int[] list() {
anArray = new int[11];
for (int i = 0; i < anArray.length; i++) {
anArray[i] = (int) randomFill();
}
return anArray;
}
public static void print() {
for (int n : anArray) {
System.out.print(n + " | ");
}
}
public static int randomFill() {
Random rand = new Random();
int randomNum = rand.nextInt(15);
return randomNum;
}
public static void main(String args[]) {
list();
print();
}
I hope that one of you can help me get on with my problem.
I know that i need to add somthing around:
public static int randomFill() {
Random rand = new Random();
int randomNum = rand.nextInt(15);
return randomNum;
}
this point, and print something out, but i can't to do what i need it to do
Aucun commentaire:
Enregistrer un commentaire