short、int、long与byte之间的转换工具类
public class FileHead { /**版本*/ public static final int VERSION = 0x00000001; /**头标志*/ public static final byte[] FLAG = {'T', 'E', 'S', 'T'}; /**压缩算法*/ public int compress = 0x00000003;} //向文件中写头信息 static void t6(){ FileHead head = new FileHead(); OutputStream out = null; head.compress = 0x04; out.write(Utility.int2Byte(head.VERSION)); out.write(head.FLAG); out.write(Utility.int2Byte(head.compress)); }