Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am uskr on github.
  • I am afmaia (https://keybase.io/afmaia) on keybase.
  • I have a public key ASApjpij1eR6LBgbBY0ZgUiEMFu3f6uuemNBwTxf64SPVgo

To claim this, I am signing this object:

@uskr
uskr / Test.java
Created October 13, 2011 14:46
Primitive long to byte[] array and back to long primitive conversions
import java.io.*;
public class Test {
static final String HEXES = "0123456789ABCDEF";
public static String getHex( byte [] raw ) {
if ( raw == null ) {
return null;
}
final StringBuilder hex = new StringBuilder( 2 * raw.length );
for ( final byte b : raw ) {