array out of index error
<p>I get the error on the line " temp.set_account_id(Integer.parseInt(st[1].trim()));". here is the code, i don't know why it is giving me an exception. help will be appreciated. </p>

<pre><code> public static int readFile(String filename, Customer[] review)throws IOException{

          int count=0;
          Scanner scan = new Scanner (new File (filename));

          /*Reading the first record separatly*/
                      Customer first = new Customer();

                      String[] a = scan.nextLine().split("=");
                      first.set_account_id(Integer.parseInt(a[1].trim()));

                      a = scan.nextLine().split("=");
                      first.set_name(a[1].toUpperCase().trim());

                      a = scan.nextLine().split("=");
                      first.set_address(a[1].trim());

                      a = scan.nextLine().split("=");
                      first.set_phone_number(a[1].trim());

                      a = scan.nextLine().split("=");
                      first.set_date_of_birth(a[1].trim());

                      a = scan.nextLine().split("=");
                      first.set_balance(Double.parseDouble(a[1].trim()));

                      review[0]= first;
                      count = count+1;

                 while (scan.hasNext()&amp;&amp; count&gt;0){
                       Customer temp = new Customer();
                       String[] st = scan.nextLine().split("=");

                       for(int i=1;i&lt;count;i++){
                             if(Integer.parseInt(st[1].trim())== review[i].get_accountid()){ // checking for duplicate records
                                  System.out.println("This account id is already in use so the record won't be read");
                                  for (int k=0; k&lt;6; k++)
                                       scan.nextLine();
                          }
                             else
                                break;
                     }


                      temp.set_account_id(Integer.parseInt(st[1].trim()));

                      st = scan.nextLine().split("=");
                      temp.set_name(st[1].toUpperCase().trim());

                      st = scan.nextLine().split("=");
                      temp.set_address(st[1].trim());

                      st = scan.nextLine().split("=");
                      temp.set_phone_number(st[1].trim());

                      st = scan.nextLine().split("=");
                      temp.set_date_of_birth(st[1].trim());

                      st = scan.nextLine().split("=");
                      temp.set_balance(Double.parseDouble(st[1].trim()));

                      if (scan.hasNextLine()){
                          scan.nextLine();
              }

                          int j;
                          for(j=0;j&lt;count;j++){

                            if (temp.get_name().compareTo(review[j].get_name())&lt;0){ // Putting records in ascending order
                                break;
                            }
                         }

                      count=count+1;
                      for (int k=count;k&gt;j;k--){
                          review[k]=review[k-1];
                      }

                      review[j]= temp;

                         if (count&gt;=30){
                         System.out.println("The number of records read has exceeded the limit and it will stop reading now");
                         break;
              }

        }

        System.out.println("The number of records read= " + count);
        //System.out.println(count);
        return count;
   }
</code></pre>
