Java toy code