Here you can find the source of fromLong(long input)
Parameter | Description |
---|---|
input | The long to convert to a byte array. |
public static byte[] fromLong(long input)
//package com.java2s; //License from project: BSD License public class Main { /**/*from ww w. j ava2s.co m*/ * Returns a byte array containing 8 network byte-ordered bytes representing * the given {@code long}. * * @param input The {@code long} to convert to a {@code byte} array. * @return A byte array representation of a {@code long}. */ public static byte[] fromLong(long input) { byte[] output = new byte[8]; output[0] = (byte) (input >> 56); output[1] = (byte) (input >> 48); output[2] = (byte) (input >> 40); output[3] = (byte) (input >> 32); output[4] = (byte) (input >> 24); output[5] = (byte) (input >> 16); output[6] = (byte) (input >> 8); output[7] = (byte) input; return output; } }