think in java and some test code