public static byte[] positionToByteArray(final long position) {
    byte[] bytes = ReplicationProtos.ReplicationHLogPosition.newBuilder().setPosition(position)
      .build().toByteArray();
    return ProtobufUtil.prependPBMagic(bytes);
  }
@param position the position to serialize
@return Serialized protobuf of <code>position</code> with pb magic prefix prepended suitable
        for use as content of an wal position in a replication queue.
hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java