public static byte[] longToBytes(final long x){
  final ByteBuffer buffer=ByteBuffer.allocate(8);
  buffer.putLong(x);
  return buffer.array();
}

public static byte [ ] longToBytes ( final long x ) { final ByteBuffer buffer = ByteBuffer . allocate ( 8 ) ; buffer . putLong ( x ) ; return buffer . array ( ) ; }
converts a long value into an array of 8 bytes .
