Finished the first Java version