Android examples for File Input Output:Byte Array Convert
Convert long To Byte array by shifting right
//package com.java2s; public class Main { public static byte[] longToBytes(long l) { byte[] result = new byte[8]; for (int i = 7; i >= 0; i--) { result[i] = (byte) (l & 0xFF); l >>= 8;/*from w w w . j a v a2s.c o m*/ } return result; } }