title: Trying to remove elements in array without any import methods
body: <p>Been trying this for a long time and have no luck. My code so far: (left some out so it's easier to read).</p>
  
  <pre><code>public class MyArrayList {
  public String[] arrays = {};
  
  public MyArrayList() {
      arrays = new String[5];
  
      }
  public String get(int i) {
      return arrays[i];
  }
  
      public boolean remove(String element) {
      String[] result = arrays;
      if (element != null) {
          int indexOf = -1;
          for (int index = 0; index &lt; arrays.length; index++) {
              if (arrays[index].equals(element)) {
                  indexOf = index;
                  break;
              }
          }
          if (indexOf &gt; -1) {
              result = new String[arrays.length -1];
              for(int index = 0; index &lt; indexOf; index++){
                  result[index]=arrays[index];
              }
              for (int index = indexOf + 1; index &lt; arrays.length; index++) {
                  result[index -1]=arrays[index];
                  arrays = result;
                  return true;
              }
  
          }
      }
      return false;
  }
  
  public class MyArrayListTest {
  
  static MyArrayList zoo = new MyArrayList();
  System.out.print("The zoo now holds " + zoo.size() + " animals: ");
      for (int j = 0; j &lt; zoo.size(); j++) System.out.print(zoo.get(j) + " ");
      System.out.println();
  }
  
  
  public static void main(String[] args) {
  
      System.out.println("Testing constructor, add(object) and size() ");
      zoo.add("Ant");
      zoo.add("Bison");
      zoo.add("Camel");
      zoo.add("Dog");
      zoo.add("Elephant");
      zoo.add("Frog");
      zoo.add("Giraffe");
      zoo.add("Horse");
      printZoo();
      System.out.println();
  
  System.out.println("Testing remove(object) ");
      System.out.println("Elephant was " + ((zoo.remove("Elephant"))? "removed " : "not in zoo "));
      System.out.println("Zebra was " + ((zoo.remove("Zebra"))? "removed " : "not in zoo "));
      System.out.println("Horse was " + ((zoo.remove("Horse")) ? "removed " : "not in zoo "));
      System.out.println("Aardvark was " + ((zoo.remove("Aardvark"))? "removed " : "not in zoo "));
      printZoo();
      System.out.println();
  </code></pre>
  
  <p>Right now the code prints: "Aardvark Ant Antelope Bison Camel Dog Elephant Frog Giraffe Gorilla Horse Ibex" </p>
  
  <p>It should remove Aardvark, Horse and Elephant and should say "Zebra is not in zoo". So That will be false in the remove method.  </p>
  
  <p>Thanks, all help appreciated, as I'm a very java programmer. </p>
  
  <p>Also an extra bit where you have to delete at a specific index. But if i get this right it will help me with that.</p>