Arrays

工具类,构造方法私有
//将数组转变为字符串
String str = Arrays.toString(int[] value);
//对于原数组进行排序,升序
Arrays.sort(int[] arr);

基本数据类型包装类

包装类 数据类型
Byte byte
Short short
Integer int
Long long
Float float
Double double
Character char
Boolean boolean

Integer与int互相转换

//int --->Integer
Integer inte = new Integer(int value);
Integer inte2 = new Integer(String value);//此处的String类型数据必须由数字组成
//Integer ---> int
int i = inte2.intValue();

int和String转换

//int --->String
String s = String.valueOf(int value);
//String ---> int
int i = Integer.ParseInt(String value);

JDK5以后新特性

//自动装箱
Integer inte = 10;
//执行过程
Integer inte = new Integer(10);
//自动拆箱
inte += 20;
//执行过程
inte = inte +20 // 自动拆箱,将inte 转换为int 与20相加,再自动装箱成Integer类型
inte = Integer.valueoOf(inte.intValue() +20);

Date

//构造方法
Date d1 = new Date();
Date d2 = new Date(long value);
//
long date1 = d1.getTime();//获取当前时间戳
long date2 = d2.getTime();//获取指定时间的时间戳
d1.setTime(long value);//设置时间

SimpleDateFormat

//date --->String
Date date = new Date();
SimpleDateFormat sft = new SimpleDateFormat(String format);//format :格式
String sDate = sft.format(date);
//String --->date
String date = "2010-10-10";
SimpleDateFormat sft = new SimpleDateFormat(String format);//format :格式
Date dDate = stf.parse(date);

最新文章

  1. C#并发编程
  2. {"集合已修改;可能无法执行枚举操作。"}
  3. Waring:This LinearLayout layout or its FrameLayout parent is useless; transfer the background attribute to the other view
  4. Web Api Route 注册要放在 Mvc Route 注册前
  5. [C++]四种方式求解最大子序列求和问题
  6. STM32 PWM波
  7. [leetcode-567-Permutation in String]
  8. Lucene 搜索的初步探究
  9. Pymongo一些常见需求(陆续补充)
  10. Python3玩转儿 机器学习(4)
  11. Selenium 实现 Web 自动化的原理 (软件测试52讲学习笔记)
  12. scikit-learn 决策树 分类问题
  13. Oracle免安装绿色版-PLSQL连接报12154
  14. 深入理解Java虚拟机4-chap6-斗者1星
  15. 数据库中,表一sum得出一个值,赋给表二的某个字段,为null
  16. react-native-echarts 安卓版打包后,部分手机图表不显示问题
  17. [Cyan之旅]使用NPOI实现Excel的导入导出,踩坑若干.
  18. 【Shell】总结·linux shell脚本攻略
  19. gevent动态随时添加任务
  20. Centos 6.4搭建git服务器【转】

热门文章

  1. redis: Hash集合类型(六)
  2. 解决利用hibernate连接mysql时无法插入汉字的问题
  3. pytorch-API实现线性回归
  4. JasperReports入门教程(四):多数据源
  5. 数据结构(C语言版)---查找
  6. 数字签名---RSA算法
  7. 这是那些大佬程序员常用的学习java网站,这就是别人薪资上万的原因
  8. 取 token 并查看 container 信息
  9. js 函数的多图片预加载(preload) 带插件版完整解析
  10. Pytorch使用PIL的读取单张图片并显示