I think you need to do something like this :
highProduct1 = (numOneTensHigh + numOneOnesHigh) *
(numTwoTensHigh + numTwoOnesHigh) *
(numThreeTensHigh + numThreeOnesHigh);
highProduct2 = (numOneTensHigh + numTwoOnesHigh) *
(numTwoTensHigh + numOneOnesHigh) *
(numThreeTensHigh + numThreeOnesHigh);
highProduct3 = (numOneTensHigh + numThreeOnesHigh) *
(numTwoTensHigh + numTwoOnesHigh) *
(numThreeTensHigh + numOneOnesHigh);
highProduct4 = (numOneTensHigh + numOneOnesHigh) *
(numTwoTensHigh + numThreeOnesHigh) *
(numThreeTensHigh + numTwoOnesHigh);
// This way try all combinations, if there are left any others ;-)
// then get the max of them.
if (max < highProduct1)
max = highProduct1;
if (max < highProduct2)
max = highProduct2;
if (max < highProduct3)
max = highProduct3;
if (max < highProduct4)
max = highProduct4;
// In the end print out the highest product
System.out.println("Highest product is : " + max);
You can do the same way for the Lowest product.
Last edited by verruckt24; Dec 2nd, 2008 at 10:44 am.