Update test code in JavaGuide4.md

Use constants instead of magic numbers in the test examples