If the first digit is 1 , then make it 0 and add 9 at the end of the String .
if ( a . charAt ( 0 ) == '1' && s . compareTo ( s1 ) == 0 ) { int l = s . length ( ) ; a = new StringBuilder ( " " ) ; a . append ( '0' ) ; for ( int i = 0 ; i < l ; i ++ ) a . append ( '9' ) ; } else { for ( int i = a . length ( ) - 1 ; i >= 0 ; i -- ) {