// WARNING: This program uses the Assertion class. When it is run, // assertions must be turned on. For example, under Linux, use: // java -ea Genfile /** Generate a data file. The size is a multiple of 4096 bytes. The records are short ints, with each record having a value less than 30,000. */ import java.io.*; import java.util.*; import java.math.*; public class Genfile2 { static final int BlockSize = 4096; static final int NumRecs = 2048; // Because they are short ints /** Initialize the random variable */ static private Random value = new Random(); // Hold the Random class object static int random(int n) { return Math.abs(value.nextInt()) % n; } public static void main(String args[]) throws IOException { short val; assert (args.length == 3) && (args[0].charAt(0) == '-') : "\nUsage: Genfile