Initial commit for  Java. Quick port from C# version and can use some optimization, use of more appropriate data types, and some cleanup and commenting