摘要: /** * 随机数上限 */ private static final int max = 9999; /** * 随机数下限 */ private static final int min = 1000; /** * 生成指定范围的随机数 * * @return */ public static 阅读全文
posted @ 2017-08-07 15:22 ameizai 阅读(139) 评论(0) 推荐(0)
摘要: /** * 获取明天 * @return */public static String getTomorrowDay() { Date date = new Date();// 取时间 Calendar calendar = new GregorianCalendar(); calendar.set 阅读全文
posted @ 2017-08-07 15:18 ameizai 阅读(105) 评论(0) 推荐(0)
摘要: // 按格式取系统日期public static String getDateWithYMD() { Calendar now = Calendar.getInstance(); int month = now.get(Calendar.MONTH) + 1; int day = now.get(C 阅读全文
posted @ 2017-08-07 14:57 ameizai 阅读(151) 评论(0) 推荐(0)
摘要: /** * 时间加减 * * @param amount * @return */public static Date dateSub(int amount) { Calendar calendar = Calendar.getInstance(); calendar.setTime(new Dat 阅读全文
posted @ 2017-08-07 14:56 ameizai 阅读(153) 评论(0) 推荐(0)
摘要: /** * 获得当前时间 * * @return */public static String getCurDateTime(String fromatStr) { DateFormat df = new SimpleDateFormat(fromatStr); return df.format(n 阅读全文
posted @ 2017-08-07 14:55 ameizai 阅读(83) 评论(0) 推荐(0)
摘要: 时间格式化 yyyy-MM-dd HH:mm:ss /** * @desc 时间格式化 yyyy-MM-dd HH:mm:ss * @param date * @return */ public static String formatTimeToStr(Date date){ String tim 阅读全文
posted @ 2017-08-07 14:54 ameizai 阅读(220) 评论(0) 推荐(0)
摘要: time 格式固定 0000-00-00 00:00:00 /** * @param time 格式固定 0000-00-00 00:00:00 * @return */ public static long strToTime(String time) { // 月 int month = Int 阅读全文
posted @ 2017-08-07 14:54 ameizai 阅读(231) 评论(0) 推荐(0)
摘要: 防止sql自动注入 /** * 防止sql自动注入 * @return */ public static String transactSQLInjection(String value){ if(!StringUtils.isEmpty(value)){ // return value.repla 阅读全文
posted @ 2017-08-07 14:53 ameizai 阅读(151) 评论(0) 推荐(0)
摘要: 数组为空判断 /** * String数组为空判断 * @param str * @return */ public static boolean isEmptyStringArray(String[] str){ boolean flag = true; if(null != str){ if(s 阅读全文
posted @ 2017-08-07 14:43 ameizai 阅读(5426) 评论(0) 推荐(0)
摘要: 判断集合是否非空 /** * 判断集合是否非空 * @param collection * @return */ public static boolean isEmptyCollection(Collection<?> collection){ boolean flag = true; if(nu 阅读全文
posted @ 2017-08-07 14:41 ameizai 阅读(1194) 评论(0) 推荐(0)
摘要: 数组去重 /** * 数组去重 * @param str * @return */ public static String[] repeat(String[] str){ HashSet<String> set = new HashSet<String>(); if(!StringUtils.is 阅读全文
posted @ 2017-08-07 14:40 ameizai 阅读(94) 评论(0) 推荐(0)
摘要: 获取本机IP(适用于Linux系统) /** * @desc 获取本机IP(适用于Linux系统) * @return Ip */ public static String getLocalIP() { String ip = ""; try { Enumeration<?> e1 = (Enume 阅读全文
posted @ 2017-08-07 14:34 ameizai 阅读(1963) 评论(0) 推荐(0)