code: 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;
    }
docs: Remove trailing zeros from string.
  
  @param str the string to be trimmed
  @return the result string without left extra zeros, or null if argument is
  null
  @since 1.1