On a class of Besicovitch functions to have exact box dimension: A necessary and sufficient condition