Example usage for org.apache.commons.lang3 Conversion longToByteArray

List of usage examples for org.apache.commons.lang3 Conversion longToByteArray

Introduction

In this page you can find the example usage for org.apache.commons.lang3 Conversion longToByteArray.

Prototype

public static byte[] longToByteArray(final long src, final int srcPos, final byte[] dst, final int dstPos,
        final int nBytes) 

Source Link

Document

Converts a long into an array of byte using the default (little endian, Lsb0) byte and bit ordering.

Usage

From source file:com.frostwire.search.CrawlPagedWebSearchPerformer.java

private static byte[] long2array(long l) {
    byte[] arr = new byte[Long.SIZE / Byte.SIZE];
    Conversion.longToByteArray(l, 0, arr, 0, arr.length);
    return arr;/*  w  ww.  j a  va2s  . c o m*/
}

From source file:org.sinekartads.util.HexUtils.java

public static String encodeHex(long value, int bytes) {
    return encodeHex(Conversion.longToByteArray(value, 0, new byte[bytes], 0, bytes));
}