code: @Override
    public void writeLong(long n) throws IOException {
      byte[] intBytes = new byte[] { (byte) ((n >>> 56) ^ 0x80),
          (byte) (n >>> 48), (byte) (n >>> 40), (byte) (n >>> 32),
          (byte) (n >>> 24), (byte) (n >>> 16), (byte) (n >>> 8), (byte) n };
      out.write(intBytes);
    }
docs: A long is written by flipping the sign bit, and writing it as a big endian
  long.
  
  @param n
  The long to encode.