Here you can find the source of fromLong(long longValue)
Parameter | Description |
---|---|
longValue | The long to interpret to binary |
public static byte[] fromLong(long longValue)
//package com.java2s; /*/* w ww . ja v a2 s .c o m*/ * Hibernate, Relational Persistence for Idiomatic Java * * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. */ public class Main { /** * Interpret a long as its binary form * * @param longValue The long to interpret to binary * * @return The binary */ public static byte[] fromLong(long longValue) { byte[] bytes = new byte[8]; bytes[0] = (byte) (longValue >> 56); bytes[1] = (byte) ((longValue << 8) >> 56); bytes[2] = (byte) ((longValue << 16) >> 56); bytes[3] = (byte) ((longValue << 24) >> 56); bytes[4] = (byte) ((longValue << 32) >> 56); bytes[5] = (byte) ((longValue << 40) >> 56); bytes[6] = (byte) ((longValue << 48) >> 56); bytes[7] = (byte) ((longValue << 56) >> 56); return bytes; } }