ArrayIndexOutOfBoundsException

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ilias
    New Member
    • Mar 2012
    • 1

    #1

    ArrayIndexOutOfBoundsException

    float[] rTOT1;
    rTOT1 = new float[j];

    for ( j = 0; j < rTOT1.length; j++) {
    float minValue = rTOT1[0];
    rTOT1[j] = (alfaTOT * rSRC + betaTOT * rSRC) / depthSrc;
    if (rTOT1[j] < minValue) {
    minValue = rTOT1[j];
    }



    if (rTOT1[j] < minScore) {
    minScore = rTOT1[j];
    bestFunct = supply;
    bestIndex = j;
    }}
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    You are accessing an index that does not exist in your array.
    System.out.prin tln the values of j at strategic points to see where your logic is incorrect

    Comment

    Working...