Here you can find the source of intToDigits(int n)
public static int[] intToDigits(int n)
//package com.java2s; //License from project: Open Source License public class Main { public static int[] intToDigits(int n) { String s = String.valueOf(n); int size = s.length(); int[] retval = new int[size]; for (int i = 0; i < size; i++) { retval[i] = Integer.parseInt(String.valueOf(s.charAt(i))); }/* w w w . j a v a 2 s . c o m*/ return retval; } }