public static String trimEnd(String value,int length){
  if (value == null || length > value.length()) {
    return EMPTY;
  }
  return value.substring(0,value.length() - length);
}

public static String trimEnd ( String value , int length ) { if ( value == null || length > value . length ( ) ) { return EMPTY ; } return value . substring ( 0 , value . length ( ) - length ) ; }
trims the given string from the end .
