how to assign numbers to an array in java code example
Example 1: change number into array in java
String temp = Integer.toString(guess);
int[] newGuess = new int[temp.length()];
for (int i = 0; i < temp.length(); i++)
{
newGuess[i] = temp.charAt(i) - '0';
}
Example 2: how to add a number to an array in java
List<Integer> myList = new ArrayList<Integer>();
myList.add(5);
myList.add(7);