How do you convert an int to an array?

Here is a simple method in java that you can use it to convert int to array of int.

  1. static int[] Int_to_array(int n)
  2. {
  3. int j = 0;
  4. int len = Integer.toString(n).length();
  5. int[] arr = new int[len];
  6. while(n!=0)
  7. {
  8. arr[len-j-1] = n%10;

For More Information Please Refer:
https://www.quora.com/How-do-I-convert-int-to-int-array-of-digts
You May Also Like to Read: