Bladeren bron

互联网医院

Trick 5 jaren geleden
bovenliggende
commit
3f26501801
1 gewijzigde bestanden met toevoegingen van 25 en 0 verwijderingen
  1. 25 0
      common/common-util/src/main/java/com/yihu/jw/util/security/Code16.java

+ 25 - 0
common/common-util/src/main/java/com/yihu/jw/util/security/Code16.java

@ -0,0 +1,25 @@
package com.yihu.jw.util.security;
/**
 * Created by Trick on 2019/7/25.
 */
public class Code16 {
    // 转化十六进制编码为字符串
    public static String toStringHex1(String s) {
        byte[] baKeyword = new byte[s.length() / 2];
        for (int i = 0; i < baKeyword.length; i++) {
            try {
                baKeyword[i] = (byte) (0xff & Integer.parseInt(s.substring(
                        i * 2, i * 2 + 2), 16));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        try {
            s = new String(baKeyword, "utf-8");// UTF-16le:Not
        } catch (Exception e1) {
            e1.printStackTrace();
        }
        return s;
    }
}