Here you can find the source of longToByte8(long value)
Parameter | Description |
---|---|
number | The int value to be converted. |
public static byte[] longToByte8(long value)
//package com.java2s; public class Main { /**/*from w ww .j a v a 2s . c o m*/ * * Method converting long into byte array. * * @param number The int value to be converted. * */ public static byte[] longToByte8(long value) { long tmp_num = value; byte[] byte8 = new byte[8]; for (int i = byte8.length - 1; i > -1; i--) { byte8[i] = (byte) (tmp_num & 0xff); tmp_num = tmp_num >> 8; } return byte8; } }