Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int BinToDec(bool[] digits)
- {
- int result = 0;
- int digitValue = 1;
- for(int x=0; x<digits.Length; x++)
- {
- result += digits[digits.Length - x - 1] ? digitValue : 0;
- digitValue *= 2;
- }
- return result;
- }
Add Comment
Please, Sign In to add comment