I have one number, for example "1256", how can I convert it into an Array?
Actually, I use a constructor of class where I stock it.
public SecretBlock(int numbersToArray) {
this.arrayOfNumbers = new int[AMOUNT];
for (int i = AMOUNT - 1; i >= 0; i--) {
this.arrayOfNumbers[i] = numbersToArray % 10;
numbersToArray /= 10;
}
}
Is there any fine/ adequate solution that may use Java 8 Stream?