Java的code或LIB脱code一个字符串的二进制和codeD十进制(BCD) [英] Java code or lib to decode a binary-coded decimal (BCD) from a String
本文介绍了Java的code或LIB脱code一个字符串的二进制和codeD十进制(BCD)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须为1的('\\ u0031')和0('\\ u0030'),稀土presents BCD值的字符串。
I have a string consisting of 1's ('\u0031') and 0's('\u0030') that represents a BCD value.
具体而言,该字符串是112个字符价值1的和0的,我需要的时间和去code他们BCD提取这些8或16为十进制。
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.
想法?包?库? code?所有这些都是值得欢迎的。
Ideas? Packages? Libs? Code? All is welcome.
推荐答案
在一个时间提取4个字符,使用的Integer.parseInt(字符串,2)应该给每个数字。结合数字,你认为合适。
Extracting 4 characters at a time and use Integer.parseInt(string, 2) should give each digit. Combine the digits as you see fit.
这篇关于Java的code或LIB脱code一个字符串的二进制和codeD十进制(BCD)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文