public static String joinHyphen(String line){
  return line.replace(" - ","-");
}

public static String joinHyphen ( String line ) { return line . replace ( " - " , "-" ) ; }
scanning from left - to - right , a hyphen surrounded by a space before and after it will become just the hyphen .
