the task is_an_bn, written in java