private static String removeLeadingZeros ( String generated ) { StringBuilder builder = new StringBuilder ( ) ; boolean leading = true ; for ( int i = 0 ; i < generated . length ( ) ; i ++ ) { if ( generated . charAt ( i ) == ' ' && leading ) { continue ; } else { leading = false ; builder . append ( generated . charAt ( i ) ) ; } } if ( builder . length ( ) == 0 ) { // very unlikely to happen, ensures that empty string is not returned builder . append ( ' ' ) ; } return builder . toString ( ) ; }
Removes leading zero numbers if present .