I want to create a boolean array of a size which the user is going to put as input.For example - The user might put a big number like 1000000000000 ; so then I have to create a boolean array of the size 1000000000000.The problem I am facing is , I cant store the input as int , as it cant hold such a big number - thus I am unable to create the array .Double is an option .I can store the input number as double , but I don't know how to create the array of the size of the double number .This was the idea -
Scanner scanner = new Scanner(System.in);
int target = scanner.nextInt();
boolean [] array_a=new boolean [(target)];
which wont work if target exceeds the int range.Any help is appreciated.
Update : Thanks guys .So you can only create an array of the size of int's max range (which is 2147483648),right?The memory aspect didn't hit me earlier. Going to take a different approach .