Pictures
All pictures on this website.
|
| Intro/Tutorial | SourceCode | FAQ? | ListOfCommands | ~~Sounds/Audio (generated by equations)~~ | PlayElectricGuitarWithTheMouse | FREE MP3s (play and modify them with CodeSimian) | Pictures | Javadoc/TechnicalDocuments | CompareToJava | Plans (what to build) | RootClass | 1 Type | SystemReq | Humans | DNA | Bugs/Flaws | Wiki | Def | my resumE (give me a programming job) | Contact | |
import java.util.*;
import java.io.*;
/** outputs a sorted list of pictures to standard-out. Uses the IMG html tag for each picture.
*/
public class Pictures{
public static void main(String a[]){
Comparator fileSize = new Comparator(){
public int compare(Object x, Object y){
return fileSize((String)x) - fileSize((String)y);
}
public boolean equals(Object o){ return o==this; }
};
Arrays.sort(a,fileSize);
for(int i=0; i");
}
public static int fileSize(String name){
try{
return new FileInputStream(new File(name)).available();
}catch(IOException e){
return Integer.MAX_VALUE;
}
}
}