binary2decimal written with debug statements
isBinary method to check whether string is valid