docs: private static void encode(final byte[] input, int inOffset, final int inLen,
              final byte[] output, int outOffset)
      {
          byte b0, b1, b2;
          final int remaining = inLen % 3, stop = inOffset + (inLen - remaining);
          while (inOffset < stop)
          {
              b0 = input[inOffset++];
              b1 = input[inOffset++];
              b2 = input[inOffset++];
              output[outOffset++] = nibble2code[(b0 >>> 2) & 0x3f];
              output[outOffset++] = nibble2code[(b0 << 4) & 0x3f | (b1 >>> 4) & 0x0f];
              output[outOffset++] = nibble2code[(b1 << 2) & 0x3f | (b2 >>> 6) & 0x03];
              output[outOffset++] = nibble2code[b2 & 077];
          }
  
          switch (remaining)
          {
              case 0:
                  break;
              case 1:
                  b0 = input[inOffset++];
                  output[outOffset++] = nibble2code[(b0 >>> 2) & 0x3f];
                  output[outOffset++] = nibble2code[(b0 << 4) & 0x3f];
                  output[outOffset++] = pad;
                  output[outOffset++] = pad;
                  break;
              case 2:
                  b0 = input[inOffset++];
                  b1 = input[inOffset++];
                  output[outOffset++] = nibble2code[(b0 >>> 2) & 0x3f];
                  output[outOffset++] = nibble2code[(b0 << 4) & 0x3f | (b1 >>> 4) & 0x0f];
                  output[outOffset++] = nibble2code[(b1 << 2) & 0x3f];
                  output[outOffset++] = pad;
                  break;
  
              default:
                  throw new IllegalStateException("should not happen");
          }
      }