Circular Queue Code
public void insert(int val) {
int next = (end + 1) % queue.length;
// wrap around
// if ( next == front )
// expand the array, or
// throw new QueueFullException();
queue[end] = val;
end = next; }
public int remove () {
int val = queue[front];
front = (front + 1) % queue.length;
// wrap around
return val; }