public static void main(String[] args) { Random rand = new Random(); MyQueue queue = new MyQueue(10); for(int i = 0; i < 20; i++) { int type = Math.abs(rand.nextInt()%2); int len = Math.abs(rand.nextInt()%10); String value = ""; for(int j = 0; j < len; j++) { value += Character.toString(new Character('a' + Math.abs(rand.nextInt()%26))); } switch(type) { case 1: System.out.println("put " + value + "(" + Integer.toString(len) + ")"); queue.put(Integer.toString(value)); break; case 0: //'empty' if no data in queue System.out.println("get " + queue.get()); break; } } System.out.println("Осталось элементов в очереди: " + Integer.toString(queue.length())); }