- java.lang.Object
-
- de.haumacher.msgbuf.binary.BinaryUtil
-
public class BinaryUtil extends Object
Utilities for binary value encoding.
-
-
Constructor Summary
Constructors Constructor Description BinaryUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intzigzagDecode(int value)Decodes the result ofzigzagEncode(int)to its original signed value.static longzigzagDecode(long value)Decodes the result ofzigzagEncode(long)to its original signed value.static intzigzagEncode(int value)Zig-zag encodes the givenintproducing a small positive number for inputs with small absolute value.static longzigzagEncode(long value)Zig-zag encodes the givenlongproducing a small positive number for inputs with small absolute value.
-
-
-
Method Detail
-
zigzagEncode
public static int zigzagEncode(int value)
Zig-zag encodes the givenintproducing a small positive number for inputs with small absolute value.- Parameters:
value- The value to encode.- Returns:
- The zig-zag encoded value.
-
zigzagEncode
public static long zigzagEncode(long value)
Zig-zag encodes the givenlongproducing a small positive number for inputs with small absolute value.- Parameters:
value- The value to encode.- Returns:
- The zig-zag encoded value.
-
zigzagDecode
public static int zigzagDecode(int value)
Decodes the result ofzigzagEncode(int)to its original signed value.- Parameters:
value- The value to decode.- Returns:
- The zig-zag decoded value.
-
zigzagDecode
public static long zigzagDecode(long value)
Decodes the result ofzigzagEncode(long)to its original signed value.- Parameters:
value- The value to decode.- Returns:
- The zig-zag decoded value.
-
-