时间工具类

import android.text.TextUtils;
import android.util.Log;
import java.security.MessageDigest;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone; /**
* 时间工具类
* <p>
* Created by javakam on 2016/7/8.
*/
public class TimeUtil {
private static final String TAG = "123";
/**
* 默认日期格式
*/
public static final String DEFAULT_FORMAT = "yyyy-MM-dd";
/**
* 点点日期格式
*/
public static final String POINT_FORMAT = "yyyy.MM.dd"; //------------------------------------------------OA--------------------------------------------------// /**
* 标题显示时间
*
* @return 今日:2017年5月15日 星期一
*/
public static String getTitleDate() {
final Calendar c = Calendar.getInstance();
c.setTimeZone(TimeZone.getTimeZone("GMT+8:00"));
String mYear = String.valueOf(c.get(Calendar.YEAR)); // 获取当前年份
String mMonth = String.valueOf(c.get(Calendar.MONTH) + 1);// 获取当前月份
String mDay = String.valueOf(c.get(Calendar.DAY_OF_MONTH));// 获取当前月份的日期号码
String mWay = String.valueOf(c.get(Calendar.DAY_OF_WEEK));
if ("1".equals(mWay)) {
mWay = "天";
} else if ("2".equals(mWay)) {
mWay = "一";
} else if ("3".equals(mWay)) {
mWay = "二";
} else if ("4".equals(mWay)) {
mWay = "三";
} else if ("5".equals(mWay)) {
mWay = "四";
} else if ("6".equals(mWay)) {
mWay = "五";
} else if ("7".equals(mWay)) {
mWay = "六";
}
return "今日: " + mYear + "年" + mMonth + "月" + mDay + "日 " + "星期" + mWay;
} /**
* 发布日志时默认进入页面显示时间为今天
*
* @return 格式: 2017.5.15
*/
public static String getLogDefaultDate(int type) {
final Calendar c = Calendar.getInstance();
c.setTimeZone(TimeZone.getTimeZone("GMT+8:00"));
String mYear = String.valueOf(c.get(Calendar.YEAR)); // 获取当前年份
String mMonth = String.valueOf(c.get(Calendar.MONTH) + 1);// 获取当前月份
String mDay = String.valueOf(c.get(Calendar.DAY_OF_MONTH));// 获取当前月份的日期号码
String mWay = String.valueOf(c.get(Calendar.DAY_OF_WEEK));
if (type == 0) {
return mYear + "." + mMonth + "." + mDay;
} else {
return mYear + "-" + mMonth + "-" + mDay;
}
} /**
* 发布日志时默认进入页面显示时间为今天
*
* @return 格式: 2017.5.15
*/
public static String getLastMonthDate() {
final Calendar c = Calendar.getInstance();
c.setTimeZone(TimeZone.getTimeZone("GMT+8:00"));
String mYear = String.valueOf(c.get(Calendar.YEAR)); // 获取当前年份
String mMonth = String.valueOf(c.get(Calendar.MONTH));// 获取当前月份 去掉 + 1
String mDay = String.valueOf(c.get(Calendar.DAY_OF_MONTH));// 获取当前月份的日期号码
String mWay = String.valueOf(c.get(Calendar.DAY_OF_WEEK));
return mYear + "." + mMonth + "." + mDay;
}
//------------------------------------------OA END------------------------------------------------------// /**
* 获取现在时间
*
* @return 返回时间类型 yyyy-MM-dd HH:mm
*/
public static String getNowDateMinute() {
return new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date());
} /**
* 服务器上的时间转换成客户端时间
* ╮(╯▽╰)╭ 8.1--php server--168035*--now--168035000
*
* @param times PHP 服务器返回时间 eg : 4026 3897
* @return 4026000 3897000
*/
public static long serverToClientTime(String times) {
if (TextUtils.isEmpty(times)) {
return 0;
}
Calendar serverNow = Calendar.getInstance();
//从PHP转成Java的时间值,在末尾添加三位
try {
serverNow.setTime(new Date(Long.parseLong(times) * 1000));
} catch (NumberFormatException e) {
return 0;
}
return serverNow.getTimeInMillis();
} /**
* 获取转化成11261000的当前时间(当前时间的格式为HH:mm:ss)
* eg : ╮(╯▽╰)╭ 8.1--php server--168035*--now--168035000
*
* @return 返回格式 11261000
*/
public static long getNowDateHourBySecond() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
String date = formatter.format(currentTime); Date date2 = null;
try {
date2 = formatter.parse(date);
Calendar cal = Calendar.getInstance();
cal.setTime(date2);
return cal.getTimeInMillis();
} catch (ParseException e) {
e.printStackTrace();
}
return 0;
} /**
* 获取现在时间
*
* @return 返回时间类型 yyyy-MM-dd HH:mm:ss
*/
public static Date getNowDate() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
ParsePosition pos = new ParsePosition(8);
Date currentTime_2 = formatter.parse(dateString, pos);
return currentTime_2;
} /**
* 获取现在时间
*
* @return返回短时间格式 yyyy-MM-dd
*/
public static Date getNowDateyyyyMMdd() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat(DEFAULT_FORMAT);
String dateString = formatter.format(currentTime);
ParsePosition pos = new ParsePosition(8);
Date currentTime_2 = formatter.parse(dateString, pos);
return currentTime_2;
} /**
* 获取现在时间
*
* @return返回字符串格式 yyyy-MM-dd HH:mm:ss
*/
public static String getDateSecondStr() {
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
} /**
* 获取当前时间
*
* @return 返回格式 yyyy-MM-dd HH:mm
*/
public static String getDateMinuteStr() {
return new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date());
} /**
* 获取当前时间 -- 今天的年月日
*
* @return 返回格式 yyyy-MM-dd
*/
public static String getStringDateyyyy_MM_dd() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat(DEFAULT_FORMAT);
String date = formatter.format(currentTime);
return date;
} /**
* 获取当前时间
*
* @return 返回格式 yyyy.MM.dd
*/
public static String getStringDateyyyyMMdd() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat(POINT_FORMAT);
String date = formatter.format(currentTime);
return date;
} /**
* 获取前月的第一天
*
* @return yyyy.MM.dd
*/
public static String getFirstDayOfThisMonth() {
SimpleDateFormat format = new SimpleDateFormat(POINT_FORMAT);
Calendar cale = Calendar.getInstance();
cale.add(Calendar.MONTH, 0);
cale.set(Calendar.DAY_OF_MONTH, 1);
return format.format(cale.getTime());
} /**
* 获取前月的最后一天
*
* @return yyyy.MM.dd
*/
public static String getLastDayOfThisMonth() {
SimpleDateFormat format = new SimpleDateFormat(POINT_FORMAT);
Calendar cale = Calendar.getInstance();
cale.add(Calendar.MONTH, 1);
cale.set(Calendar.DAY_OF_MONTH, 0);
return format.format(cale.getTime());
} /**
* 获取今年第一天日期
*
* @return String 日期格式:今年第一天 2018-01-01
*/
public static String getCurrYearFirst() {
Calendar c = Calendar.getInstance();
c.add(Calendar.YEAR, 0);
c.set(Calendar.DAY_OF_YEAR, 1);//设置为1号,当前日期既为本年第一天
return formateDate(c.getTime());
} /**
* 获取某年第一天日期
*
* @param year 年份 2018
* @return Date
*/
public static Date getCurrYearFirst(int year) {
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(Calendar.YEAR, year);
Date currYearFirst = calendar.getTime();
return currYearFirst;
} /**
* 获取某年第一天日期
*
* @param year 年份 2018
* @return String
*/
public static String getCurrYearFirstStr(int year) {
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(Calendar.YEAR, year);
return formateDate(calendar.getTime());
} /**
* 获取某年最后一天日期
*
* @param year 年份 2018
* @return Date
*/
public static Date getCurrYearLast(int year) {
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(Calendar.YEAR, year);
calendar.roll(Calendar.DAY_OF_YEAR, -1);
Date currYearLast = calendar.getTime();
return currYearLast;
} /**
* 获取某年最后一天日期
*
* @param year 年份 2018
* @return String
*/
public static String getCurrYearLastStr(int year) {
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(Calendar.YEAR, year);
calendar.roll(Calendar.DAY_OF_YEAR, -1);
return formateDate(calendar.getTime());
} /**
* 两时间比较大小
*
* @param setDate 日期参数格式 yyyy-MM-dd
* @param nowDate 日期参数格式 yyyy-MM-dd
* @return true setDate <= nowDate and default
*/
public static boolean compared(String setDate, String nowDate) {
SimpleDateFormat dateFormat = new SimpleDateFormat(DEFAULT_FORMAT);
try {
Date date1 = dateFormat.parse(setDate);
Date date2 = dateFormat.parse(nowDate);
if (date1.getTime() <= date2.getTime()) {
return true;
} else {
return false;
}
} catch (ParseException e) {
e.printStackTrace();
}
return true;
} /**
* 两时间比较大小
*
* @param setDate 日期参数格式 yyyy-MM-dd HH:mm
* @param nowDate 日期参数格式 yyyy-MM-dd HH:mm
* @return true setDate <= nowDate and default
*/
public static boolean compared2(String setDate, String nowDate) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
try {
Date date1 = dateFormat.parse(setDate);
Date date2 = dateFormat.parse(nowDate);
if (date1.getTime() <= date2.getTime()) {
return true;
} else {
return false;
}
} catch (ParseException e) {
e.printStackTrace();
}
return true;
} /**
* 两时间比较大小
*
* @param setDate 日期参数格式 Date
* @param nowDate 日期参数格式 Date
* @return true setDate <= nowDate and default
*/
public static boolean compared2(Date setDate, Date nowDate) {
if (setDate.getTime() <= nowDate.getTime()) {
return true;
}
return false;
} /**
* 将日期格式转为毫秒数
*
* @param in 格式为 2014-09-30
* @return 返回格式为 1345185923140
*/
public static long dateToLong(String in) {
SimpleDateFormat format = new SimpleDateFormat(DEFAULT_FORMAT);
try {
Date date = format.parse(in);
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal.getTimeInMillis();
} catch (ParseException e) {
e.printStackTrace();
} return 0;
} /**
* 将日期格式转为毫秒数
*
* @param in 格式为 2014年9月30日
* @return 返回格式为 1345185923140
*/
public static long dateToLong3(String in) {
SimpleDateFormat format = new SimpleDateFormat("yyyy年M月dd日");
try {
Date date = format.parse(in);
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal.getTimeInMillis();
} catch (ParseException e) {
e.printStackTrace();
}
return 0;
} /**
* 将日期格式转为毫秒数
*
* @param in 格式为 2014-09-30 09:50
* @return 返回格式为 1345185923140
*/
public static long dateToLong1(String in) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
try {
Date date = format.parse(in);
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal.getTimeInMillis();
} catch (ParseException e) {
e.printStackTrace();
} return 0;
} /**
* 将日期格式转为毫秒数
*
* @param in 格式为 2014年09月30日 09:50
* @return 返回格式为 1345185923140
*/
public static long dateToLong2(String in) {
SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
try {
Date date = format.parse(in);
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal.getTimeInMillis();
} catch (ParseException e) {
e.printStackTrace();
} return 0;
} /**
* 将日期格式转为毫秒数
*
* @param in 格式为 2014-09-30 09:50:30
* @return 返回格式为 1345185923140
*/
public static long dateToLong4(String in) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
Date date = format.parse(in);
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal.getTimeInMillis();
} catch (ParseException e) {
e.printStackTrace();
} return 0;
} /**
* 将日期格式转为毫秒数
*
* @param in 格式为 2014-09-30
* @return 返回格式为 1345185923140
*/
public static long dateToLong5(String in) {
SimpleDateFormat format = new SimpleDateFormat(DEFAULT_FORMAT);
try {
Date date = format.parse(in);
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal.getTimeInMillis();
} catch (ParseException e) {
e.printStackTrace();
}
return 0;
} /**
* 将日期格式转为毫秒数
*
* @param in 格式为 2014.09.30
* @return 返回格式为 1345185923140
*/
public static long dateToLong6(String in) {
SimpleDateFormat format = new SimpleDateFormat(POINT_FORMAT);
try {
Date date = format.parse(in);
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal.getTimeInMillis();
} catch (ParseException e) {
e.printStackTrace();
}
return 0;
} /**
* 将毫秒数转为日期
*
* @param millis 格式为1345185923140L
* @return 返回格式为 年-月-日 时:分:秒
*/
public static String longToDate(long millis) {
Date date = new Date(millis);
Calendar gc = Calendar.getInstance();
gc.setTime(date);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String sb = format.format(gc.getTime());
System.out.println(sb);
return sb;
} /**
* 将long数转为日期
*
* @param millis 格式为1345185923140
* @return 返回格式为 年-月-日 时:分
*/
public static String longToDate1(long millis) {
Date date = new Date(millis);
Calendar gc = Calendar.getInstance();
gc.setTime(date);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
String sb = format.format(gc.getTime());
System.out.println(sb);
return sb;
} /**
* 将毫秒数转为日期
*
* @param millis 格式为1345185923140L
* @return 返回格式为 年-月-日
*/
public static String longToDate2(long millis) {
Date date = new Date(millis);
Calendar gc = Calendar.getInstance();
gc.setTime(date);
SimpleDateFormat format = new SimpleDateFormat(DEFAULT_FORMAT);
String sb = format.format(gc.getTime());
System.out.println(sb);
return sb;
} /**
* 将毫秒数转为日期
*
* @param millis 格式为1345185923140L
* @return 返回格式为 2014年09月07日 10:30
*/
public static String longToDate3(long millis) {
Date date = new Date(millis);
Calendar gc = Calendar.getInstance();
gc.setTime(date);
SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
String sb = format.format(gc.getTime());
System.out.println(sb);
return sb;
} /**
* 将毫秒数转为日期
*
* @param millis 格式为1345185923140L
* @return 返回格式为 2014年09月07日
*/
public static String longToDate4(long millis) {
Date date = new Date(millis);
Calendar gc = Calendar.getInstance();
gc.setTime(date);
SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日");
String sb = format.format(gc.getTime());
System.out.println(sb);
return sb;
} /**
* 将毫秒数转为日期
*
* @param millis 格式为1345185923140L
* @return 返回格式为 2014-09-07-10-30-10
*/
public static String longToDate5(long millis) {
Date date = new Date(millis);
Calendar gc = Calendar.getInstance();
gc.setTime(date);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
String sb = format.format(gc.getTime());
Log.d(TAG, sb);
return sb;
} /**
* 将毫秒数转为日期
*
* @param millis 格式为1345185923140L
* @return 返回格式为 20140907103010
*/
public static String longToDate6(long millis) {
Date date = new Date(millis);
Calendar gc = Calendar.getInstance();
gc.setTime(date);
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
String sb = format.format(gc.getTime());
Log.d(TAG, sb);
return sb;
} /**
* 将毫秒数转为日期
*
* @param millis 格式为1493913600000
* @return 返回格式为 2017.05.22
*/
public static String longToDate7(long millis) {
Date date = new Date(millis);
Calendar gc = Calendar.getInstance();
gc.setTime(date);
SimpleDateFormat format = new SimpleDateFormat(POINT_FORMAT);
return format.format(gc.getTime());
} /**
* 将毫秒数转为日期
*
* @param millis 格式为1493913600000
* @return 返回格式为 2017-05-22
*/
public static String longToDate8(long millis) {
Date date = new Date(millis);
Calendar gc = Calendar.getInstance();
gc.setTime(date);
SimpleDateFormat format = new SimpleDateFormat(DEFAULT_FORMAT);
return format.format(gc.getTime());
} /**
* 转换剩余时间
*
* @param millis
* @return
*/
public static String getEndTime(String millis) {
long t = Long.parseLong(millis);
Date date = new Date(t);
Calendar gc = Calendar.getInstance();
gc.setTime(date);
SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss");
String sb = format.format(gc.getTime());
Log.e(TAG, "剩余时间---" + sb);
return sb;
} /**
* 格式化时间
*
* @param date
* @return 返回格式 yyyy-MM-dd
*/
public static String formateDate(Date date) {
return new SimpleDateFormat(DEFAULT_FORMAT).format(date);
} public static String formatTime(String dateTimeStr) {
if ((null != dateTimeStr) && (dateTimeStr.length() > 0)) {
String[] strs = dateTimeStr.split("-");
String newStr = strs[3] + ":" + strs[4];
return newStr;
} else {
return null;
}
} /**
* 将2015-10-18-16-47-30格式时间转换为 2015年10月18日 16:47
*
* @param dateTime
* @return
*/
public static String formatTime1(String dateTime) {
if (!TextUtils.isEmpty(dateTime)) {
String[] strs = dateTime.split("-");
String newStr = strs[0] + "年" + strs[1] + "月" + strs[2] + "日 " + strs[3] + ":" + strs[4];
return newStr;
} else {
return "";
}
} /**
* 将2015-10-18-16-47-30格式时间转换为 2015-10-18 16:47
*
* @param dateTime
* @return
*/
public static String formatTime2(String dateTime) {
if (!TextUtils.isEmpty(dateTime)) {
String[] strs = dateTime.split("-");
String newStr = strs[0] + "-" + strs[1] + "-" + strs[2] + " " + strs[3] + ":" + strs[4];
return newStr;
} else {
return "";
}
} /**
* 将2015-10-18-16-47-30格式时间转换为 2015-10-18
*
* @param dateTime
* @return
*/
public static String formatTime3(String dateTime) {
if (!TextUtils.isEmpty(dateTime)) {
String[] strs = dateTime.split("-");
String newStr = strs[0] + "-" + strs[1] + "-" + strs[2];
return newStr;
} else {
return "";
}
} /**
* 将 yyyy-MM-dd 格式时间转换为 yyyy.MM.dd
*
* @param dateTime
* @return
*/
public static String formatTime4(String dateTime) {
if (!TextUtils.isEmpty(dateTime)) {
String newTime = dateTime.replace("-", ".");
return newTime;
} else {
return "";
}
} /**
* 将 yyyy-MM-dd HH:mm:ss 格式时间转换为 yyyy.MM.dd
*
* @param dateTime
* @return
*/
public static String formatTime5(String dateTime) {
if (!TextUtils.isEmpty(dateTime)) {
String newTime = dateTime.substring(0, 10);
return newTime.replace("-", ".");
} else {
return "";
}
} /**
* 将MaterialCalendarView上点击返回的Date格式时间 转换为 yyyy-MM-dd
*
* @return 返回格式 yyyy-MM-dd
*/
public static String formatTimeMdCalendar1(Date date) {
return formateDate(date);
} /**
* 将MaterialCalendarView上点击返回的Date格式时间 转换为 yyyy.MM.dd
*
* @return 返回格式 yyyy.MM.dd
*/
public static String formatTimeMdCalendar2(Date date) {
return new SimpleDateFormat(POINT_FORMAT).format(date);
} /**
* 将MaterialCalendarView上点击返回的Date格式时间 转换为 yyyy-MM-dd HH:mm
*
* @return 返回格式 yyyy-MM-dd HH:mm
*/
public static String formatTimeMdCalendar3(Date date) {
return new SimpleDateFormat("yyyy-MM-dd HH:mm").format(date);
} /**
* 服务器返回时间格式:2015/10/9 0:00:00
*
* @param time
* @return 2015-10-09
*/
public static String convertTime(String time) { if (!TextUtils.isEmpty(time)) {
String str[] = time.split(" ");
if (str.length > 1) {
str[0] = str[0].replaceAll("/", "-");
String s[] = str[0].split("-");
String res = null;
if (s.length == 3) {
res = s[0];
if (s[1].length() == 1) {
res += "-0" + s[1];
} else {
res += "-" + s[1];
}
if (s[2].length() == 1) {
res += "-0" + s[2];
} else {
res += "-" + s[2];
}
}
return res;
}
}
return null;
} /**
* 将本地的时间转换为云端的时间
*/
public static String convertNativeTimeToCloudTime(String timeStr) {
if (!TextUtils.isEmpty(timeStr)) { String[] tempStrs = timeStr.split("-");
int year = Integer.parseInt(tempStrs[0]);
int month = Integer.parseInt(tempStrs[1]);
int day = Integer.parseInt(tempStrs[2]);
String hour = "00";
String minute = "00";
String second = "00";
if (tempStrs.length == 6) {
hour = tempStrs[3];
minute = tempStrs[4];
second = tempStrs[5];
}
if (minute.length() == 1) {
minute = "0" + minute;
}
if (second.length() == 1) {
second = "0" + second;
}
String finalTime = year + "/" + month + "/" + day + " " + hour + ":" + minute + ":" + second;
return finalTime;
} else {
return "";
}
} /**
* 获取MD5加密的字符串
*
* @param str
* @return
*/
public static String md5Encrypt(String str) {
MessageDigest md5 = null;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (Exception e) {
Log.d(TAG, e.toString());
e.printStackTrace();
return "";
}
char[] charArray = str.toCharArray();
byte[] byteArray = new byte[charArray.length]; for (int i = 0; i < charArray.length; i++) {
byteArray[i] = (byte) charArray[i];
}
byte[] md5Bytes = md5.digest(byteArray);
StringBuffer hexValue = new StringBuffer();
for (int i = 0; i < md5Bytes.length; i++) {
int val = ((int) md5Bytes[i]) & 0xff;
if (val < 16) {
hexValue.append("0");
}
hexValue.append(Integer.toHexString(val));
}
return hexValue.toString();
}
}

Java&Android TimeUtil ~ A Good Util!的更多相关文章

  1. [Java][Android][Process] 暴力的服务能够解决一切,暴力的方式运行命令行语句

    不管是在Java或者Android中运行命令行语句殊途同归都是创建一个子进程运行调用可运行文件运行命令.类似于Windows中的CMD一样. 此时你有两种方式运行:ProcessBuilder与Run ...

  2. Java Android HTTP实现总结

    Java Android HTTP实现总结 Http(Hypertext Transfer Protocol)超文本传输协议,是一个基于请求/响应模式的无状态的协议,Http1.1版给出了持续连接的机 ...

  3. Xml解析之——Java/Android/Python

    Xml解析之——Java/Android/Python 一.Xml文件 test.xml <note> <to>George</to> <from>Jo ...

  4. 关于Java代码优化的44条建议!

    关于Java代码优化的N条建议! 本文是作者:五月的仓颉 结合自己的工作和平时学习的体验重新谈一下为什么要进行代码优化.在修改之前,作者的说法是这样的: 就像鲸鱼吃虾米一样,也许吃一个两个虾米对于鲸鱼 ...

  5. Atitit.嵌入式web 服务器 java android最佳实践

    Atitit.嵌入式web 服务器 java android最佳实践 1. Android4.4.21 2. 自己的webserver1 3. CyberHTTP for Java  cybergar ...

  6. 关于java.lang.NoSuchMethodError: org.springframework.util.ReflectionUtils.makeAccessible

    <span style="font-size:18px;"> java.lang.NoSuchMethodError: org.springframework.util ...

  7. Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/util/PatternMatchUtils

    { "message": "Handler dispatch failed; nested exception is java.lang.NoClassDefFoundE ...

  8. 实习生4面美团Java岗,已拿offer!(框架+多线程+集合+JVM)

    美团技术一面 1.自我介绍 说了很多遍了,很流畅捡重点介绍完. 2.问我数据结构算法好不好 挺好的(其实心还是有点虚,不过最近刷了很多题也只能壮着胆子充胖子了) 3.找到单链表的三等分点,如果单链表是 ...

  9. Java/Android引用类型及其使用分析

    Java/Android中有四种引用类型,分别是: Strong reference     - 强引用Soft Reference        - 软引用Weak Reference      - ...

随机推荐

  1. 下载安装ngnix

    在这个网站上进行下载,http://nginx.org/en/download.html,由于我的是windows系统 我下载解压后,打开文件夹里面看到ngix.exe,我去双击它,发现它就是一闪,后 ...

  2. 通过父元素的hover控制子元素的显示

    .searbar_content_box:hover .searchBar_checked_detail_box{ display:block}

  3. GP card规范学习笔记

    9.   APDU命令参考 9.1  总的编码规则 A.生命周期状态的编码 可执行的装载文件 b8 b7 b6 b5 b4 b3 b2 b1 含义 16进制命令  0 0 0 0 0 0 0 1 LO ...

  4. Yii2中多表关联查询(hasOne、hasMany、join、joinwith)

    表结构 现在有客户表.订单表.图书表.作者表, 客户表Customer   (id  customer_name) 订单表Order      (id  order_name  customer_id ...

  5. 虚拟机安装及配置(centOs7)

    准备工作 a)下载VMware workstation14 b)下载CentOS7 CentOS7 c)下载xshell.xftp 安装参考 分区设置 补充(解决网络IP问题,设置IP,service ...

  6. Vue 中使用 viewerjs

    安装 viewerjs npm install viewerjs --save 创建一个 Viewer.vue 组件 <template> <div id="index&q ...

  7. liunx top命令详解

    1,当前服务器时间,up,服务器离上一次重启过了多久,多少个用户在使用,cpu平均负载,grep 'core id' /proc/cpuinfo | sort -u | wc -l  ,一般来说4个, ...

  8. 【java】static用法

    static作用: 用来修饰函数成员,成员变量和成员函数.类对象的属性都一致且能共享,比如国籍,这就能用static修饰,name不能共享,因为每个人都有自己的名字. 特有内容(name)随着对象存储 ...

  9. Oracle 关于concat与双竖线用法的补充

    --只能连接2个字符串select concat('nod',' chen is ') from dual; --连接2个列名select concat(name,ip2) from vm_info; ...

  10. ORACLE procedure 一个参数分解成多个字符一点建议

    测试时给什么变量就会生成什么变量, 但是在PROCEDURE时,你给的变量就会变成去掉包含字符q'/ /' 使用procedure splice添加字符串结果,是不包含q'/.删除时用的riqi赋值语 ...