added Java example for UnaryFunction callback