public class MyDeque
 {
 private int maxsize;
 private int [] queArray;
 private int front;
 private int rear;
 private int nItems;
 public MyDeque (int s)
    {
         maxsize = s;
         queArray= new int[maxsize];
         front=0;
         rear=-1;
         nItems=0;
    }
 public void insertRear(int j)
     {
         if (rear==maxsize-1)
         rear=-1;
         queArray[++rear]=j;
         nItems++;
    }
public void inserFront (int j)
    {
        if (front==0)
        front=maxsize;
        queArray[--front]=j;
        nItems++;
    }
 public int removeFront()
    {
         int temp= queArray[front++];
         if(front==maxsize)
         front=0;
         nItems--;
         return temp;
    }
 public int removeRear()
    {
         int temp =queArray[rear--];
         if (rear==-1)
         rear=maxsize-1;
         nItems--;
         return temp;
    }
public int peekFront()
    {
         return queArray[front];
    }
 public int peekRear()
    {
         return queArray[rear];
    }

 public boolean isEmpty ()
    {
         return (nItems==0);
    }
 public boolean isFull()
    {
         return (nItems==maxsize);
    }
 public int size ()

    {
         return nItems;
    }

Edited 3 Years Ago by Reverend Jim: Fixed formatting

.....and that's what she said.
But in all seriousness you need to put that in code tags
and look up the scanner class

This article has been dead for over six months. Start a new discussion instead.