app/src/main/java/com/example/hybss/utils/Base64.java
private static byte[] encodeInner(byte[] data) {
        byte[] bytes;

        int modulus = data.length % 3;
        if (modulus == 0) {
            bytes = new byte[4 * data.length / 3];
        } else {
            bytes = new byte[4 * ((data.length / 3) + 1)];
        }

        int dataLength = (data.length - modulus);
        int a1, a2, a3;
        for (int i = 0, j = 0; i < dataLength; i += 3, j += 4) {
            a1 = data[i] & 0xff;
            a2 = data[i + 1] & 0xff;
            a3 = data[i + 2] & 0xff;

            bytes[j] = encodingTable[(a1 >>> 2) & 0x3f];
            bytes[j + 1] = encodingTable[((a1 << 4) | (a2 >>> 4)) & 0x3f];
            bytes[j + 2] = encodingTable[((a2 << 2) | (a3 >>> 6)) & 0x3f];
            bytes[j + 3] = encodingTable[a3 & 0x3f];
        }

        /*
         * process the tail end.
         */
        int b1, b2, b3;
        int d1, d2;

        switch (modulus) {
        case 0: /* nothing left to do */
            break;
        case 1:
            d1 = data[data.length - 1] & 0xff;
            b1 = (d1 >>> 2) & 0x3f;
            b2 = (d1 << 4) & 0x3f;

            bytes[bytes.length - 4] = encodingTable[b1];
            bytes[bytes.length - 3] = encodingTable[b2];
            bytes[bytes.length - 2] = (byte) '=';
            bytes[bytes.length - 1] = (byte) '=';
            break;
        case 2:
            d1 = data[data.length - 2] & 0xff;
            d2 = data[data.length - 1] & 0xff;

            b1 = (d1 >>> 2) & 0x3f;
            b2 = ((d1 << 4) | (d2 >>> 4)) & 0x3f;
            b3 = (d2 << 2) & 0x3f;

            bytes[bytes.length - 4] = encodingTable[b1];
            bytes[bytes.length - 3] = encodingTable[b2];
            bytes[bytes.length - 2] = encodingTable[b3];
            bytes[bytes.length - 1] = (byte) '=';
            break;
        }

        return bytes;
    }
/**
     * encode the input data producong a base 64 encoded byte array.
     * 
     * @return a byte array containing the base 64 encoded data.
     */
encode the input data producong a base 64 encoded byte array.

@return a byte array containing the base 64 encoded data.
encode the input data producong a base 64 encoded byte array . @return a byte array containing the base 64 encoded data .
private static byte[] encodeInner(byte[] data) {
        byte[] bytes;
        int modulus = data.length % 3;
        if (modulus == 0) {
            bytes = new byte[4 * data.length / 3];
        } else {
            bytes = new byte[4 * ((data.length / 3) + 1)];
        }
        int dataLength = (data.length - modulus);
        int a1, a2, a3;
        for (int i = 0, j = 0; i < dataLength; i += 3, j += 4) {
            a1 = data[i] & 0xff;
            a2 = data[i + 1] & 0xff;
            a3 = data[i + 2] & 0xff;
            bytes[j] = encodingTable[(a1 >>> 2) & 0x3f];
            bytes[j + 1] = encodingTable[((a1 << 4) | (a2 >>> 4)) & 0x3f];
            bytes[j + 2] = encodingTable[((a2 << 2) | (a3 >>> 6)) & 0x3f];
            bytes[j + 3] = encodingTable[a3 & 0x3f];
        }
        /*
         * process the tail end.
         */
        int b1, b2, b3;
        int d1, d2;
        switch (modulus) {
        case 0: /* nothing left to do */
            break;
        case 1:
            d1 = data[data.length - 1] & 0xff;
            b1 = (d1 >>> 2) & 0x3f;
            b2 = (d1 << 4) & 0x3f;
            bytes[bytes.length - 4] = encodingTable[b1];
            bytes[bytes.length - 3] = encodingTable[b2];
            bytes[bytes.length - 2] = (byte) '=';
            bytes[bytes.length - 1] = (byte) '=';
            break;
        case 2:
            d1 = data[data.length - 2] & 0xff;
            d2 = data[data.length - 1] & 0xff;
            b1 = (d1 >>> 2) & 0x3f;
            b2 = ((d1 << 4) | (d2 >>> 4)) & 0x3f;
            b3 = (d2 << 2) & 0x3f;
            bytes[bytes.length - 4] = encodingTable[b1];
            bytes[bytes.length - 3] = encodingTable[b2];
            bytes[bytes.length - 2] = encodingTable[b3];
            bytes[bytes.length - 1] = (byte) '=';
            break;
        }
        return bytes;
    }
private static byte [ ] encodeInner ( byte [ ] data ) { byte [ ] bytes ; int modulus = data . length % 3 ; if ( modulus == 0 ) { bytes = new byte [ 4 * data . length / 3 ] ; } else { bytes = new byte [ 4 * ( ( data . length / 3 ) + 1 ) ] ; } int dataLength = ( data . length - modulus ) ; int a1 , a2 , a3 ; for ( int i = 0 , j = 0 ; i < dataLength ; i += 3 , j += 4 ) { a1 = data [ i ] & 0xff ; a2 = data [ i + 1 ] & 0xff ; a3 = data [ i + 2 ] & 0xff ; bytes [ j ] = encodingTable [ ( a1 >>> 2 ) & 0x3f ] ; bytes [ j + 1 ] = encodingTable [ ( ( a1 << 4 ) | ( a2 >>> 4 ) ) & 0x3f ] ; bytes [ j + 2 ] = encodingTable [ ( ( a2 << 2 ) | ( a3 >>> 6 ) ) & 0x3f ] ; bytes [ j + 3 ] = encodingTable [ a3 & 0x3f ] ; } /*
         * process the tail end.
         */ int b1 , b2 , b3 ; int d1 , d2 ; switch ( modulus ) { case 0 : /* nothing left to do */ break ; case 1 : d1 = data [ data . length - 1 ] & 0xff ; b1 = ( d1 >>> 2 ) & 0x3f ; b2 = ( d1 << 4 ) & 0x3f ; bytes [ bytes . length - 4 ] = encodingTable [ b1 ] ; bytes [ bytes . length - 3 ] = encodingTable [ b2 ] ; bytes [ bytes . length - 2 ] = ( byte ) '=' ; bytes [ bytes . length - 1 ] = ( byte ) '=' ; break ; case 2 : d1 = data [ data . length - 2 ] & 0xff ; d2 = data [ data . length - 1 ] & 0xff ; b1 = ( d1 >>> 2 ) & 0x3f ; b2 = ( ( d1 << 4 ) | ( d2 >>> 4 ) ) & 0x3f ; b3 = ( d2 << 2 ) & 0x3f ; bytes [ bytes . length - 4 ] = encodingTable [ b1 ] ; bytes [ bytes . length - 3 ] = encodingTable [ b2 ] ; bytes [ bytes . length - 2 ] = encodingTable [ b3 ] ; bytes [ bytes . length - 1 ] = ( byte ) '=' ; break ; } return bytes ; }
encode the input data producong a base 64 encoded byte array.
encode the input data producong a base 64 encoded byte array .