| | |
| | | |
| | | import org.junit.Test; |
| | | |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | import static com.doumee.keyCabinet.utils.i485.SportUtils.hexToBinary; |
| | | |
| | | public class ExampleUnitTest { |
| | | @Test |
| | | public void addition_isCorrect() { |
| | | String s = "80010000FFEF33B2"; |
| | | String dm = s.substring(4,12); |
| | | System.out.println("===1>"+dm); |
| | | dm = dm.replaceAll("0",""); |
| | | System.out.println("===2>"+dm); |
| | | dm = SportUtils.hexToBinary(dm); |
| | | System.out.println("===3>"+dm); |
| | | StringBuilder sb = new StringBuilder(dm); |
| | | dm = sb.reverse().toString(); |
| | | System.out.println("===4>"+dm); |
| | | for(int i=1;i<=dm.length();i++){ |
| | | String key = SportUtils.intToHex(i); |
| | | System.out.println("===>"+key+","+("1".equals(dm.substring(i-1,i))?"关":"开")); |
| | | String s = "Result:12.00mg/100ml"; |
| | | Pattern pattern = Pattern.compile("([0-9]+\\.[0-9]+)"); |
| | | Matcher matcher = pattern.matcher(s); |
| | | if (matcher.find()) { |
| | | System.out.println(matcher.group(1)); // 输出: 12.00 |
| | | } |
| | | } |
| | | |