Source Code : Convert long to Bytes
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Convert long to Bytes
public class Util {
public static byte[] toBytes(long n) {
byte[] b = new byte[8];
b[0] = (byte) (n >>> 56);
b[1] = (byte) (n >>> 48);
b[2] = (byte) (n >>> 40);
b[3] = (byte) (n >>> 32);
b[4] = (byte) (n >>> 24);
b[5] = (byte) (n >>> 16);
b[6] = (byte) (n >>> 8);
b[7] = (byte) (n);
return b;
}
}
Thank with us