Added Java Version of your C++ code

I used http://www.tangiblesoftwaresolutions.com/ to convert the c++ to java then cleaned up the code. Thanks for the original code!