How can I compare previous value of same variable(result) with current value.
Example, result 1 > result 2 or not, result 2 > result 3 or not, result 3 > result 4 or not, result 4 > result 5 or not.
import java.util.Random; public class Test { public static void main(String args[]){ double A = 5; Test Cal = new Test(); Cal.run(A); } void run(double A){ Random random = new Random(); double result; int i = 0; do{ i++; result = A + random.nextGaussian() / 2; System.out.println(result); }while(i<5); } }
regard
ray