(long value)
| 49 | |
| 50 | |
| 51 | public boolean delete(long value) {//delete the element if it found |
| 52 | for(int i=0;i<this.nElements;i++){ |
| 53 | if(this.a[i]==value){ |
| 54 | for(int j=i; j<this.nElements-1;i++){ |
| 55 | this.a[j]=this.a[j+1]; |
| 56 | } |
| 57 | this.nElements--; |
| 58 | System.out.println("Value Deleted"); |
| 59 | return true; |
| 60 | } |
| 61 | |
| 62 | } |
| 63 | return false;//value is not found for deletion |
| 64 | } |
| 65 | |
| 66 | |
| 67 | public void display() {//display array contents |