title: how to delete a value from an array and shrink the array?
body: <p>I've been doing tons of programming challenges and have lately encountered this problem: how to delete a value from an array and then shrink the array? I know how to tackle the problem by using the <code>Arraylist</code> and its <code>methods</code> but I'd like to know how to do the problem from scratch by using the basic array with fixed size. I'd really appreaciate if smb explains the solution elaborately.</p>
  
  <pre><code>public static int[] shrinkArray(int key)
  {
      int[] resultArray = new int[myArray.length];
      for(int i = 0; i &lt; myArray.length; i++)
      {
          if(myArray[i] == key)
             break;
      }
  
   return resultArray;
  }
  </code></pre>