code: public static String bytesToBase64Url(byte[] bytes) {
          String result = (new String(Base64.encodeBase64(bytes), MESSAGE_ENCODING)).replace("=", "").replace("\\", "").replace('+', '-')
                  .replace('/', '_');
          return result;
      }
docs: Convert bytes array to Base64Url string.
  
  @param bytes
  bytes array
  
  @returns Encoded string.