Code example for Queue

Methods: add, remove, size

0
	} 
 
	@Override 
	public synchronized void dataReceived(byte[] data, int size) {
		lastDuration_ = ByteArrayToLong(data, size);
		if (pulseQueue_.size() == MAX_QUEUE_LEN) {
			pulseQueue_.remove();
		} 
		pulseQueue_.add(lastDuration_);
		valid_ = true;
		notifyAll();
	} 
 
	private static long ByteArrayToLong(byte[] data, int size) {
		long result = 0;
		int i = size;
		while (i-- > 0) {
			result <<= 8;
			result |= ((int) data[i]) & 0xFF;
		} 
		if (result == 0) {