![]() ![]() This code may be used (including commercial products) without warranties of any kind (use at your own risk)Īs long as this copyright notice is retained.Īuthor, under no circumstances, shall not be responsible for any code crashes or bugs. /rebates/&252fc-string-to-bcd. ((char*)&bcdresult) |= i & 1 ? (val % 10) Binary to Packed BCD ![]() I Googled BCD Java and got this as the first result. Surely someone out there has written a BCD conversion utility for Java. ![]() I am using a stringbuilder to make a string and a byte with a variable: private void toBcd(String value. After, i have to read the BCD and convert it to the original string 0200 but first i have to resolve String to BCD. unsigned long toPackedBcd (unsigned int val) I don t understand why its failing, since the BCD field should be able to store 4 digits, and since the number of decimals is 2 (which would use up 1 byte), the remaining 1 byte (since our total BCD field is of length 2, and 1 byte has been used for storing the 2 decimal places), should be enough for storing the 2 digits 1 and 4. Hi everyone, Im trying to convert a String to BCD.
0 Comments
Leave a Reply. |