Java code or lib to decode a binary-coded decimal (BCD) from a String
问题 I have a string consisting of 1's ('\u0031') and 0's('\u0030') that represents a BCD value. Specifically, the string is 112 characters worth of 1's and 0's and I need to extract either 8 or 16 of these at a time and decode them from BCD to decimal. Ideas? Packages? Libs? Code? All is welcome. 回答1: Extracting 4 characters at a time and use Integer.parseInt(string, 2) should give each digit. Combine the digits as you see fit. 回答2: I think you're missing all the fun: Here's a basic