java
文章平均质量分 61
zldongv
只为追求技术的深度!
展开
-
将字符串json写入到服务器文件中
public static boolean saveDataToFile(String data,File filepath){ boolean isSaveSuccess=false; BufferedWriter writer=null; try { writer=new BufferedWriter(new Fi原创 2017-09-08 22:33:31 · 1195 阅读 · 0 评论 -
密码加密之MD5+Base64
public static String createEncryptPSW(String psw) throws Exception { MessageDigest messagedigest = null; try { messagedigest = MessageDigest.getInstance("MD5");原创 2017-09-08 22:37:31 · 439 阅读 · 0 评论 -
UUID除去‘-’
/** * 功能:去掉UUID中的“-” */ public static String replaceUUID(String uuid) { uuid = uuid.replaceAll("\\-", ""); return uuid; } /** * 功能:获取UUID并去除“-”原创 2017-09-08 22:38:26 · 12698 阅读 · 0 评论 -
字符串、字节数组、可序列化对象之间的相互转化
/** * 把16进制字符串转换成字节数组 * * @param hex * @return */ public static byte[] hexStringToByte(String hex) { int len = (hex.length() / 2); byte[] result =原创 2017-09-08 22:45:06 · 1862 阅读 · 0 评论 -
日期时间工具类
private static SimpleDateFormat fullSimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public static final String format ="yyyy-MM-dd HH:mm:ss"; public static final原创 2017-09-08 22:51:40 · 218 阅读 · 0 评论 -
DES加密、Base64加密\File文件相互转换
注意:DES加密和解密过程中,密钥长度都必须是8的倍数/** * 加密 * * @param datasource byte[] * @param password String * @return byte[] */ public static byte[] encrypt(byte[] dat原创 2017-09-08 23:02:55 · 606 阅读 · 0 评论 -
常用正则表达式
/** * 正则相关常量 */public final class RegexConstants { /** * 正则:手机号(简单) */ public static final String REGEX_MOBILE_SIMPLE = "^[1]\\d{10}$"; /** * 正则:手机号(精确)原创 2017-09-08 23:13:11 · 243 阅读 · 0 评论