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 | grep -v /"); Scanner sc = new Scanner(pr.getInputStream()); ArrayList lis = new ArrayList<>(); while(sc.hasNext()) { String s = sc.next(); if (s.startsWith(".")) { continue; } lis.add(s); } Collections.sort(lis); for(String s: lis) { System.out.println(s); } } }