public static String addQuotationMarksIfNeeded(String str){
  if (!str.startsWith("\"") && !str.isEmpty())   return "\"" + str + "\"";
  return str;
}

public static String addQuotationMarksIfNeeded ( String str ) { if ( ! str . startsWith ( "\"" ) && ! str . isEmpty ( ) ) return "\"" + str + "\"" ; return str ; }
add quotation marks at the beginning and end of the string .
