Here you can find the source of long2Word(long val)
public static byte[] long2Word(long val)
//package com.java2s; //License from project: Open Source License public class Main { public static byte[] long2Word(long val) { byte[] ret = new byte[4]; int firstByte = (int) (val & 0xFF000000L) >> 24; int secondByte = (int) (val & 0x00FF0000L) >> 16; int thirdByte = (int) (val & 0x0000FF00L) >> 8; int fourthByte = (int) (val & 0x000000FFL); ret[0] = (byte) firstByte; ret[1] = (byte) secondByte; ret[2] = (byte) thirdByte; ret[3] = (byte) fourthByte; return (ret); }// www . jav a 2 s. c om }