public static String removeTrailingZeros(final String str){
  String result=str;
  if (str != null && str.length() != 0) {
    int endIndex=str.length();
    while (endIndex > 1) {
      final char ch=str.charAt(endIndex - 1);
      if (ch != '0') {
        break;
      }
      endIndex--;
    }
    if (endIndex < str.length()) {
      result=str.substring(0,endIndex);
    }
  }
  return result;
}

public static String removeTrailingZeros ( final String str ) { String result = str ; if ( str != null && str . length ( ) != 0 ) { int endIndex = str . length ( ) ; while ( endIndex > 1 ) { final char ch = str . charAt ( endIndex - 1 ) ; if ( ch != '0' ) { break ; } endIndex -- ; } if ( endIndex < str . length ( ) ) { result = str . substring ( 0 , endIndex ) ; } } return result ; }
remove trailing zeros from string .
