public static String addSlashToEnd(String string){
  if (string != null && !string.equals("") && string.charAt(string.length() - 1) != '/') {
    return string.concat("/");
  }
  return string;
}

public static String addSlashToEnd ( String string ) { if ( string != null && ! string . equals ( "" ) && string . charAt ( string . length ( ) - 1 ) != '/' ) { return string . concat ( "/" ) ; } return string ; }
adds slash at the end of string if it doesn ' t already start with slash
