code: public static String getBasicAuthenticationEncoding(String username, String password) throws FoxHttpRequestException {
          String userPassword = username + ":" + password;
  
          Class<?> base64;
          try {
              base64 = Class.forName("java.util.Base64");
              Object objectToInvokeOn = base64.getEnclosingClass();
              Method encoderMethod = base64.getDeclaredMethod("getEncoder");
              Object encoder = encoderMethod.invoke(objectToInvokeOn);
              Method method = encoder.getClass().getDeclaredMethod("encodeToString", byte[].class);
  
              return (String) (method.invoke(encoder, (Object) userPassword.getBytes()));
          } catch (ClassNotFoundException e) {
              try {
                  base64 = Class.forName("android.util.Base64");
  
                  Object objectToInvokeOn = base64.getEnclosingClass();
                  Method encoderMethod = base64.getDeclaredMethod("encodeToString", byte[].class, int.class);
  
                  return (String) (encoderMethod.invoke(objectToInvokeOn, userPassword.getBytes(), 2));
              } catch (Exception e1) {
                  throw new FoxHttpRequestException(e1);
              }
          } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
              throw new FoxHttpRequestException(e);
          }
  
      }
docs: Create user:password string for authentication.
  
  @return user:password string