Java exercise: custom string log