This is at least one problem in your put method:
boolean full = (start == (end+storage.length+1)%storage.length); while(full){
If full initialized to true , how do you expect the loop to complete?
Another problem is the consumerโs cycle:
while(!buffer.isEmpty()) { int i = buffer.take(); System.out.println("Consumer reads "+i); }
You assume that the producer will never empty the buffer - if the consumer starts work in front of the producer, he will immediately stop.
Instead, you need a way to tell the buffer that you stopped producing. The consumer must continue to accept until the queue is empty and receives more data.
source share