All pastes #168 Raw Edit

stuff for school

public text v1 · immutable
#168 ·published 2004-05-25 19:34 UTC
rendered paste body
import java.io.*;
import java.util.Arrays;

public class arraysave implements Serializable{
	public static void main(String s[]) throws IOException, ClassNotFoundException{
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));	    	
		double array[] = new double[5];
		System.out.println("Input 5 numbers for an array");
		Util.skip(1);
		for(int x=0;x<5;x++){
			System.out.print(">> ");
			array[x] = Util.toDouble(input.readLine());
		}
		FileOutputStream fos = new FileOutputStream("array.tmp");
		ObjectOutputStream oos = new ObjectOutputStream(fos);
		oos.writeObject(array);
		oos.close();
		FileInputStream fis = new FileInputStream("array.tmp");
		ObjectInputStream ois = new ObjectInputStream(fis);
		double[] foo = (double[])ois.readObject();
		ois.close();
		Arrays.sort(foo);
		System.out.println(foo[0]);
	}
}