package no3010; import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Process pr = Runtime.getRuntime().exec("ls /bin -F"); Scanner sc = new Scanner(pr.getInputStream()); ArrayList lis = new ArrayList<>(); int count = 0; while(sc.hasNext()) { count++; String s = sc.next(); if (s.startsWith(".") || s.endsWith("/")) { continue; } lis.add(s); } if (count < 2) { throw new RuntimeException(); } Collections.sort(lis); for(String s: lis) { System.out.println(s); } } }