Something like this should do the trick:
public void scaleArray(double[] anArray, double scaleValue) {
for(int i = 0; i < anArray.length; i++) {
anArray[i] *= scaleValue;
}
}
m
I have 3 arrays (norm1[], norm2[], norm3[]) that i need to pass into this method in order to rescale them.Will the following code do that?
public void scaleArray(double[] anArray, 255)
{
for(int i = 0; i < anArray.length; i++) {
for(int j = 0; j < anArray.width; j++) {
anArray<i> *= 255; }
}
int new1 []= norm1[].scaleArray;
and the same for the other 2?
Thank u very much
Maria
public void scaleArray(double[] anArray, int low, int high)
{
for(int i = 0; i < anArray.length; i++) {
for(int j = 0; j < anArray.width; j++) {
anArray<i> = (high-low) * anArray<i> + low;
}
}
}
//...
double[] norm1;
scaleArray(norm1, 0, 255);