To speed up my image processing application, I'm trying to address values in an array starting in the middle, and using indices starting at 0.
For example, when I work with two arrays, I often have a situation like this:
public void work(int[] array1, int[] array2, int offset)
{
int len = array1.length;
for (int i = 0; i < len; i++)
array1[i] += array2[i + offset];
}
so I would like to create a new variable, array3 that directly maps into the middle of array2 (not a copy), so I can do this:
public void work(int[] array1, int[] array2, int offset)
{
int[] array3 = array2[offset]...;
int len = array1.length;
for (int i = 0; i < len; i++)
array1[i] += array3[i];
}
In effect, I want a Java equivalent to this c statement:
int *array3ptr = array2ptr + offset;
Note: I don't have any experience with JNI or anything, so if it boils down to using this, please provide working examples.