Move Ruby impl to ruby dir.
Add Java implementation.