private static String encode64(byte[] Input) {
		int iLen = Input.length;

		int oDataLen = (iLen * 4 + 2) / 3; // output length without padding
		int oLen = ((iLen + 2) / 3) * 4; // output length including
		// padding
		char[] out = new char[oLen];
		int ip = 0;
		int op = 0;
		while (ip < iLen) {
			int i0 = Input[ip++] & 0xff;
			int i1 = ip < iLen ? Input[ip++] & 0xff : 0;
			int i2 = ip < iLen ? Input[ip++] & 0xff : 0;
			int o0 = i0 >>> 2;
			int o1 = ((i0 & 3) << 4) | (i1 >>> 4);
			int o2 = ((i1 & 0xf) << 2) | (i2 >>> 6);
			int o3 = i2 & 0x3F;
			out[op++] = iota64[o0];
			out[op++] = iota64[o1];
			out[op] = op < oDataLen ? iota64[o2] : '=';
			op++;
			out[op] = op < oDataLen ? iota64[o3] : '=';
			op++;
		}
		return new String(out);
	}