public static void main(String[] args) {
        final BoundedBuffer<Integer> buffer = new BoundedBuffer<Integer>(5);
        final Random random = new Random();

        Thread thread1 = new Thread(new Runnable() {
            @Override
            public void run() {
                int t1 = 1000;
                while (true && t1 < 2000) {
                    buffer.put(t1++);
                    try {
                        Thread.sleep(random.nextInt(20));
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        });
        Thread thread2 = new Thread(new Runnable() {
            @Override
            public void run() {
                int t2 = 2000;
                while (true && t2 < 3000) {
                    buffer.put(t2++);
                    try {
                        Thread.sleep(random.nextInt(20));
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        });
        Thread thread3 = new Thread(new Runnable() {
            @Override
            public void run() {
                while (true) {
                    buffer.get();
                    try {
                        Thread.sleep(random.nextInt(10));
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        });

        thread1.start();
        thread2.start();
        thread3.start();


    }