时间工具类

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. C# 图片处理方法 整理汇总

    /// <summary> /// 图片转为base64编码字符 /// </summary> /// <param name="path">图 ...

  2. hdu 6241 Color a Tree 2017 CCPC 哈理工站 L

    Bob intends to color the nodes of a tree with a pen. The tree consists of NN nodes. These nodes are ...

  3. IC卡T0协议中的过程字与状态字

    T0协议中,IC卡收到命里头以后向TTL回传过程字或状态字SW1.SW2: TTL和IC卡在二者之间的命令和数据交换的任何时刻都必须知道数据流的方向和IO线路由谁驱动. 摘录参考:<中国金融集成 ...

  4. leetcode 3.Longest Substring Without Repeating Charcters

    在一个字符串中寻找出最长的无重复字符的子串的,在不断的后续检索中需要去掉前面一个重复的字符,那么就是需要记录之前所出现过的字符的,在这里需要利用hashmap来记录字符和其出现的位置之间的映射关系的, ...

  5. 硬件电路io口控制继电器电路

    元件如下: 二极管 8050三极管 1K电阻 10K电阻 光耦817 5V继电器 各一个 ———————————————————————————————————— 电路图如下: 当IO是低电平的时候, ...

  6. js的一些方法

    input的值: value.toUpperCase();//value.toUpperCase()把字符窜转换为大写 random方法: Math.floor对数字向下舍入 Math.random( ...

  7. Angular + Websocket

    Angular使用RxJS,它本质上是一个反应式扩展的javascript实现.这是一个使用可观察序列组成异步和基于事件的程序的库,非常适合使用WebSockets. 简而言之,RxJS允许我们从we ...

  8. 在windows上使用ssh秘钥连接git服务器

    git部署在centos7上 安装好git后,新建一个用户test(注意要加入git用户组)配置ssh秘钥登录,我的另一篇博客有写配置步骤 重点的地方是在windows系统上使用秘钥登录git服务器 ...

  9. algernon 基于golang 的独立的支持redis lua pg。。。 的web server

    algernon 看到github 的介绍很很强大,一下子想到了openresty,功能看着很强大,支持 redis pg lua markdown quic http2 mysql 限速 pongo ...

  10. zombodb 低级api 操作

    zombodb 低级api 允许直接从zombodb 索引中进行insert.delete 文档,同时保留了mvcc 的特性,但是数据没有存储在 pg 中,但是也带来数据上的风险,我们需要注意进行es ...