直接上代码:
//先写进去
long n = 1000000L;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
dos.write(n);
//再读出来
byte[] buf = baos.toByteArray();
直接上代码:
//先写进去
long n = 1000000L;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
dos.write(n);
//再读出来
byte[] buf = baos.toByteArray();