code: public static String getBasicAuth(String user, final String pass) {
  
      return "Basic " + java.util.Base64.getEncoder().encodeToString((user + ":" + pass).getBytes());
    }
docs: Generates a BASE64 Basic Authentication String
  
  @return BASE64 Basic Authentication String