I want to return an array with the index's where the getElem() is equal or higher a certain value.
This is my function:
public static int []findIndex(BufferedImage image,int value)
{
DataBuffer b = image.getRaster().getDataBuffer();
int array[] = new int[600];
for(int i=0;i<76400;i++)
{
if(b.getElem(i)>=value)
array[i]=i;
}
return array;
}
but i have an error
"Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 27001
at arraytest.imageMan.findIndex(imageMan.java:139)
at arraytest.imageMan.main(imageMan.java:183)"
600, so anything greater than 599 will throw error !!!76400? Since your array is only stores 601 elements this might cause the problem?