ix.test
Class LongToBytes
java.lang.Object
ix.test.LongToBytes
public class LongToBytes
- extends java.lang.Object
Method Summary |
static long |
bytesToLong(byte[] bytes)
Converts a (big-endian) array of bytes to a long |
static java.lang.String |
bytesToLongStrings(byte[] bytes)
Converts an array of bytes to a string containing the
"/"-separated string representations of longs taken from
the array. |
static long |
decode(java.lang.String s)
|
static java.lang.String |
encode(long l)
|
static byte[] |
longToBytes(long l)
Converts a long to a (big-endian) array of bytes. |
static void |
main(java.lang.String[] argv)
|
(package private) static java.lang.String |
printName(byte[] bytes)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LongToBytes
public LongToBytes()
main
public static void main(java.lang.String[] argv)
printName
static java.lang.String printName(byte[] bytes)
longToBytes
public static byte[] longToBytes(long l)
- Converts a long to a (big-endian) array of bytes.
bytesToLong
public static long bytesToLong(byte[] bytes)
- Converts a (big-endian) array of bytes to a long
bytesToLongStrings
public static java.lang.String bytesToLongStrings(byte[] bytes)
- Converts an array of bytes to a string containing the
"/"-separated string representations of longs taken from
the array. This is done by wrapping a DataInputStream
around a ByteArrayInputStream based on the array, to
get the longs, and calling
encode(long)
to get the string representations.
It is assumed that the length of the byte array
is a multiple of 8.
encode
public static java.lang.String encode(long l)
decode
public static long decode(java.lang.String s)