Updates language to Java

Updates code from Ruby to Java as described in block.