add thinking in java code