Results 1 to 2 of 2
  1. #1
    javagirl is offline Member
    Join Date
    Feb 2014
    Posts
    6
    Rep Power
    0

    Default ArrayIndexOutofBoundsException

    Still trying to get a handle on arrays! So, I declare an array to be a 46x1 and I am trying to populate it with a Log formula that I am using but I keep getting an ArrayIndexOutofBoundsException. Any suggestions will be greatly appreciated.

    code

    private double[][] LNValues = new double[46][1];
    //Calculating y=LN(E-k) and Initializing the Array
    for(int x=0; x<LNValues.length; x++)
    {
    double i = Math.log(eValues[x][1] - kValue);
    if(i > 0)
    {
    LNValues[x][1] = roundThreeDecimals(i);
    }
    else
    {
    LNValues[x][1] = 0;
    }

    }

    /code

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    4,018
    Rep Power
    6

    Default Re: ArrayIndexOutofBoundsException

    I mentioned this in the other post --> 2 Dimensional Array

    Arrays start indexing at 0, not 1.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. ArrayIndexOutOfBoundsException
    By finfanman in forum New To Java
    Replies: 3
    Last Post: 06-25-2012, 07:27 PM
  2. Replies: 3
    Last Post: 04-10-2011, 09:28 PM
  3. ArrayIndexOutOfBoundsException: 10 ??
    By Yakg in forum New To Java
    Replies: 2
    Last Post: 12-04-2010, 07:56 PM
  4. ArrayIndexOutOfBoundsException
    By Corey in forum New To Java
    Replies: 5
    Last Post: 02-02-2010, 02:25 AM
  5. ArrayIndexOutOfBoundsException
    By flaskvacuum in forum New To Java
    Replies: 6
    Last Post: 07-14-2009, 06:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •