private static void benchFloat(ArrayFile af, int n) throws IOException { float[] a = randfloat(n); float[] b = zerofloat(n); int nio; Stopwatch sw = new Stopwatch(); sw.start(); for (nio = 0; sw.time() < 5.0; ++nio) { af.seek(0); af.writeFloats(a); af.seek(0); af.readFloats(b); } sw.stop(); for (int i = 0; i < n; ++i) if (a[i] != b[i]) throw new RuntimeException(" float: i/o failure"); double time = sw.time(); double rate = 2.0 * 4.0e-6 * nio * n / time; System.out.println(" float: rate=" + rate + " MB/s"); }