code: public static int remove (int[] list, int value)
      {
          // nothing to remove from an empty list
          if (list == null) {
              return 0;
          }
  
          int llength = list.length; // no optimizing bastards
          for (int i = 0; i < llength; i++) {
              int val = list[i];
              if (val == value) {
                  System.arraycopy(list, i+1, list, i, llength-(i+1));
                  list[llength-1] = 0;
                  return val;
              }
          }
          return 0;
      }
docs: Removes the first value that is equal to the supplied value. The
  values after the removed value will be slid down the array one spot
  to fill the place of the removed value.
  
  @return the value that was removed from the array or zero if no
  matching object was found.