sorting files in directory by size using java array list [duplicate]
问题 This question already has answers here : How can I sort files in a directory in java? (2 answers) Closed 5 years ago . The directory has n number of files.I am creating class, it will sort files by size from directory using java arraylist. I can read the file name and size. but how to sort the files by size? import java.io.File; import java.io.FilenameFilter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; public class