private byte[] encodeNum(long l, int maxBytes) {
    byte[] rv = new byte[maxBytes + 1];

    for (int i = 0; i < rv.length - 1; i++) {
      int pos = rv.length - i - 1;
      rv[pos] = (byte) ((l >> (8 * i)) & 0xff);
    }

    return rv;
  }
Handles old whalin (tested with v1.6) encoding: data type is in the first
byte of the value.

@author bpartensky
@since Oct 16, 2008
src/main/java/net/spy/memcached/transcoders/WhalinV1Transcoder.java