Here you can find the source of convertLongToBytes(final long unsignedIntIp)
private static byte[] convertLongToBytes(final long unsignedIntIp)
//package com.java2s; //License from project: Open Source License public class Main { private static byte[] convertLongToBytes(final long unsignedIntIp) { byte[] bytes = new byte[4]; bytes[0] = (byte) ((unsignedIntIp & 0xFF000000L) >>> 24); bytes[1] = (byte) ((unsignedIntIp & 0x00FF0000L) >> 16); bytes[2] = (byte) ((unsignedIntIp & 0x0000FF00L) >> 8); bytes[3] = (byte) (unsignedIntIp & 0x000000FFL); return bytes; }/*w w w . j a v a2 s. c o m*/ }