Here you can find the source of longToByteArray(long longHi, long longLo, byte[] array, int offset)
public static int longToByteArray(long longHi, long longLo, byte[] array, int offset)
//package com.java2s; /*//from ww w . ja v a 2 s .c o m * Copyright 2009 Thomas Bocek * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ public class Main { public static int longToByteArray(long longHi, long longLo, byte[] array, int offset) { array[offset++] = (byte) (longHi >>> 56); array[offset++] = (byte) (longHi >>> 48); array[offset++] = (byte) (longHi >>> 40); array[offset++] = (byte) (longHi >>> 32); array[offset++] = (byte) (longHi >>> 24); array[offset++] = (byte) (longHi >>> 16); array[offset++] = (byte) (longHi >>> 8); array[offset++] = (byte) longHi; array[offset++] = (byte) (longLo >>> 56); array[offset++] = (byte) (longLo >>> 48); array[offset++] = (byte) (longLo >>> 40); array[offset++] = (byte) (longLo >>> 32); array[offset++] = (byte) (longLo >>> 24); array[offset++] = (byte) (longLo >>> 16); array[offset++] = (byte) (longLo >>> 8); array[offset++] = (byte) longLo; return offset; } }