Back testing in java