Skip to content

Instantly share code, notes, and snippets.

@miclovich
Created June 10, 2013 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miclovich/5749356 to your computer and use it in GitHub Desktop.
Save miclovich/5749356 to your computer and use it in GitHub Desktop.
sorting and making your life a whole lot easier
/*
* File: FindRange.java
* Name:
* Section Leader:
* --------------------
* This file is the starter file for the FindRange problem.
*/
import java.util.ArrayList;
import acm.program.*;
import acmx.export.java.util.Collections;
import acmx.export.java.util.List;
public class FindRange extends ConsoleProgram {
private ArrayList<Integer> array = new ArrayList<Integer>();
public void run() {
for (int i = 0; i < 7; i++) {
array.add(readInt("Put in a value: "));
}
// Collections.sort((List) array);
println("smallest: "+Collections.min((List) array));
println("Largest: "+ Collections.max((List) array));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment