Java question based on method calls...?
Ok, so what I am trying to do for this prodject is this; I have a method that calculates the difference in of array elements in such that ar[1] - ar[0] and then ar[2] - ar[1] and so on...
Now I have a method that does that fine and works. However I am creating another method that finds the smallest change from that output. How do I call the method above to solve this problem?
/**
Difference of array elements
@param Array of doubles
*/
public static void diffTotal(double ar[]) {
int i = 0;
while (i < ar.length) {
if (i == ar.length - 1) {
break;
}else {
double subtraction = ar[i+1] - ar[i];
System.out.println(subtraction);
}
++i;
}
}
/**
Smallest change in array measurements
@param Array of doubles
*/
public static void smallChange(double ar[]) {
|