Update MaximizingProduct.java

Optimizing code.