public static String fromArray (byte[] data) {
		
		// allocate result buffer
		StringBuffer buf = new StringBuffer();
		int size = data.length;
		// compute padding
		int padding = (3 - (size % 3)) % 3;

		// process all bytes in array...
		for (int n = 0; n < size; n += 3) {
			// check for final (truncated) block
			boolean eof = size < (n + 3);

			// assemble three byte integer value
			int val = (data[n] & 0xFF);
			val = (val << 8) | (eof && padding == 2 ? 0 : (data[n+1] & 0xFF));
			val = (val << 8) | (eof && padding >  0 ? 0 : (data[n+2] & 0xFF));

			// convert to four-character encoding.
			buf.append (charset.charAt ((val >> 18) & 0x3F));
			buf.append (charset.charAt ((val >> 12) & 0x3F));
			buf.append (eof && padding == 2 ? "=" : charset.charAt ((val >> 6) & 0x3F));
			buf.append (eof && padding >  0 ? "=" : charset.charAt ( val       & 0x3F));
		}
		// return representation
		return buf.toString();
	}