private static String intToString ( int value , int digit ) { StringBuilder stringBuilder = new StringBuilder ( digit ) ; stringBuilder . append ( Integer . toString ( value ) ) ; while ( stringBuilder . length ( ) < digit ) { stringBuilder . insert ( 0 , "0" ) ; } return stringBuilder . toString ( ) ; }
Create String representation of integer . Preceding 0 will be add as needed .