protected static void removeTralingZeros ( StringBuilder sb ) { int endIndex = sb . length ( ) ; if ( endIndex > 0 ) { -- endIndex ; int index = endIndex ; while ( sb . charAt ( index ) == ' ' ) { -- index ; } if ( index < endIndex ) sb . delete ( index + 1 , endIndex + 1 ) ; } }
Utility to remove the trailing 0 s .