package no3010; import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Main { public static void main(String[] args) { try { Process pr = Runtime.getRuntime().exec("ls ~/bin"); Scanner sc = new Scanner(pr.getInputStream()); ArrayList lis = new ArrayList<>(); while(sc.hasNext()) { String s = sc.nextLine(); if (s.startsWith(".")) { continue; } lis.add(s); } Collections.sort(lis); for(String s: lis) { System.out.println(s); } }catch (Exception e) { throw new RuntimeException(); //System.out.println("分からず"); } } }