/* * @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(); }