62,621
社区成员
发帖
与我相关
我的任务
分享
public static void main(String[] args) {
int start = Integer.parseInt("00000000", 2);
int end = Integer.parseInt("11111111", 2);
byte[] outputData = new byte[end - start + 1];
for (int i = start; i <= end; i++) {
outputData[i] = (byte)i;
}
FileOutputStream fos = null;
try {
fos = new FileOutputStream("d:\\binaray.bin");
fos.write(outputData);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}