Here you can find the source of getArrayListFromInt(int number)
public static ArrayList getArrayListFromInt(int number)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; public class Main { final static int[] sizeTable = { 9, 99, 999, 9999, 99999, 999999, 9999999, 99999999, 999999999, Integer.MAX_VALUE };// w ww .j a v a 2s . c om public static ArrayList getArrayListFromInt(int number) { ArrayList<Integer> list = new ArrayList<>(); int length = stringSize(number); for (int i = length - 1; i >= 0; i--) { list.add(0, number % 10); number /= 10; } return list; } public static int stringSize(int x) { for (int i = 0;; i++) if (x <= sizeTable[i]) return i + 1; } }