code: private static String toBase64( byte[] bytes ) {
          if( base64 == null ) {
              try {
                  Class<?> clazz = Class.forName( "java.util.Base64" );
                  encoder = clazz.getMethod( "getEncoder" ).invoke( null );
                  base64 = encoder.getClass().getMethod( "encodeToString", byte[].class );
                  base64.setAccessible( true ); /// performance optimizing
              } catch( Throwable th1 ) {
                  try {
                      Class<?> clazz = Class.forName( "javax.xml.bind.DatatypeConverter" );
                      base64 = clazz.getMethod( "printBase64Binary", byte[].class );
                      encoder = null;
                      base64.setAccessible( true ); /// performance optimizing
                  } catch( Throwable th2 ) {
                      th1.addSuppressed( th2 );
                      throw new LessException( th1 );
                  }
              }
          }
          try {
              return (String)base64.invoke( encoder, bytes );
          } catch( Throwable th ) {
              throw new LessException( th );
          }
      }
docs: Hack for base64 in Java 7 to Java 9.
  <ul>
  <li>In Java 7 we use: javax.xml.bind.DatatypeConverter.printBase64Binary( byte[] )
  <li>in Java 8-9 we use: java.util.Base64.getEncoder().encodeToString( byte[] )
  </ul>
  @param bytes the bytes to converted
  @return the base64 encoded string
  @throws LessException if the reflection does not work