瞎写了写,不知道对不对
public class Main {
@
SneakyThrows public static void main(String[] args) {
byte[][] ip = new byte[1000000][4];
long start = System.currentTimeMillis();
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream("D:\\Cache\\ip.bin"));
int count = 0;
for (int i = 0; i < 255; i++) {
for (int j = 0; j < 255; j++) {
for (int k = 0; k < 255; k++) {
for (int l = 0; l < 255; l++) {
ip[count][0] = (byte) i;
ip[count][1] = (byte) j;
ip[count][2] = (byte) k;
ip[count][3] = (byte) l;
count++;
if (count % 1000000 == 0) {
for (int m = 0; m < 1000000; m++) {
bufferedOutputStream.write(ip[m]);
}
count = 0;
}
}
}
}
}
bufferedOutputStream.close();
long end = System.currentTimeMillis();
System.out.println(end - start);
}
}
时间:144663
占用空间:15.7 GB (16,912,003,072 字节)