I am trying to typecast an integer array into a long array, but I don't quite know how to go about doing this.
So far, my code looks like this:
import java.util.Random;
public class main {
public static int[] sect(){
int[] returned = new int[4];
Random rand = new Random();
returned[0] = 4;
returned[1] = rand.nextInt(8) + 1;
returned[2] = rand.nextInt(7) + 1;
returned[3] = rand.nextInt(6) + 1;
return returned;
}
public static String num(){
for (int j = 0; j < 4; j++) {
int[] ints = sect();
for(int i =0; i < ints.length; i++) {
System.out.print(ints[i]);
}
}
return null;
}
}
I have tried doing things like:
return ((long)num());
But that never works. Does anyone know how I would go about doing this?