/*
* @value : 加密字符串长度
* @return : 返回加密字符串长度
*/
public static String packN(int value) {
byte[] bytes = ByteBuffer.allocate(4).putInt(new Integer(value)).array();
try {
return new String(bytes, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return null;
}
/*
* @value : 解密字符串
* @return : 返回解密字符串长度
*/
public static int unpackN(String value) {
return ByteBuffer.wrap(value.getBytes()).getInt();
}
版权声明:本文为wang2470198567原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。