question: public static int [ ] toDigits ( int number ) { ArrayList < Integer > digitsList = new ArrayList < Integer > ( ) ; if ( number == 0 ) { return new int [ ] { 0 } ; } while ( number != 0 ) { digitsList . add ( number % 10 ) ; number /= 10 ; } int [ ] digits = new int [ digitsList . size ( ) ] ; for ( int i = digitsList . size ( ) - 1 ; i >= 0 ; i -- ) { digits [ i ] = digitsList . get ( digitsList . size ( ) - i ) ; } return digits ; }
target:  Transforms an integer into a set of digits