public static long longToZigZag(final long n) {
        return (n << 1) ^ (n >> 63);
    }
copy google protocol buffer
https://github.com/google/protobuf/blob/master/java/src/main/java/com/google/protobuf/CodedOutputStream.java
commons/src/main/java/com/navercorp/pinpoint/common/util/BytesUtils.java