P169: Added Java and Mathematica solutions.