The code is quite difficult to follow. Perhaps you could edit your post to remove redundant empty lines and correct the indentation.

What is m supposed to represent in the binaryToDecimal()...