Code example for BufferOverflowException

0
		//if(full) tail = (tail + 1) % buffer.length;  
		head = head % buffer.length;
	} 
	 
	public synchronized T getLast(int n){
		if(n >= buffer.length) throw new BufferOverflowException();
		 
		int ptr = head - n - 1; 
		if(ptr < 0){
			if(!full) throw new BufferUnderflowException();
			else ptr += buffer.length; 
		} 
		 
		return buffer[ptr];
	} 
	 
	public synchronized T getLast(){ 
		return getLast(0); 
	} 
	 
	/**