code: public static String encodeX(byte[] a) {
  	// check input
  	if (a == null || a.length == 0) {
  	    return "X''";
  	}
  	char[] out = new char[a.length * 2 + 3];
  	int i = 2;
  	for (int j = 0; j < a.length; j++) {
  	    out[i++] = xdigits[(a[j] >> 4) & 0x0F];
  	    out[i++] = xdigits[a[j] & 0x0F];
  	}
  	out[0] = 'X';
  	out[1] = '\'';
  	out[i] = '\'';
  	return new String(out);
      }
docs: Encodes the given byte array into SQLite3 blob notation, ie X'..'
  @param a the byte array to be encoded. A null reference is handled as
  an empty array.
  @return the encoded bytes as a string.