import java.util.*; class One { public static void main(String[] args) { int[] b; Scanner a = new Scanner(System.in); Vektor v = new Vektor(); System.out.print("prompt> "); String line = a.nextLine(); while (! line.equals("finished")) { int num = Integer.parseInt(line); v.add(num); System.out.print("prompt> "); line = a.nextLine(); } v.show(); v.sort(); v.show(); } } class Vektor { int[] storage; Vektor() { storage = new int[0]; } void add(int elem) { int[] b = new int[storage.length + 1]; for (int i = 0; i < storage.length; i++) b[i] = storage[i]; b[storage.length] = elem; storage = b; } void show() { System.out.println( Arrays.toString( storage ) ); } void sort() { Arrays.sort(storage ); } }