how to make int array in java code example
Example 1: java int to int array
int number = 110101;
String temp = Integer.toString(number);
int[] numbers = new int[temp.length()];
for (int i = 0; i < temp.length(); i++) {
numbers[i] = temp.charAt(i) - '0';
}
Example 2: how to declare array java
int intArray[];
intArray = new int[20];
int[] intArray = new int[20];
Example 3: java int array
int[] theNumbers = new int[5];
arr[0] = 4;
arr[1] = 8;
arr[2] = 15;
arr[3] = 16;
arr[4] = 23;
arr[5] = 42;
Example 4: array declaration and initialization in java
int[] age = new int[5];
Example 5: work with arrays java
new String[] { "A", "B"}