直接上代码:
//先写进去
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();
转载于:https://www.cnblogs.com/esileme/p/7529027.html