public static String removeLast(String input,int amount){
  if (input.length() >= amount) {
    return input.substring(0,input.length() - amount);
  }
 else {
    return input;
  }
}

public static String removeLast ( String input , int amount ) { if ( input . length ( ) >= amount ) { return input . substring ( 0 , input . length ( ) - amount ) ; } else { return input ; } }
remove last characters of a string
