项目中发现别人写好的操作系统相关的工具类: 我总结的类似相关博客:http://www.cnblogs.com/DreamDrive/p/4289860.html import java.net.InetAddress; import java.net.UnknownHostException; import java.util.List; /** * OS Utility Class This is used to obtain the os related var programmatica…
一.Android4.4版本以上Uri地址封装规范: content://com.android.providers.media.documents/document/image%3A659 二.Android4.4版本以下Uri地址没被封装的,地址规范: /storage/emulated/0/Pictures/07 绚彩夜拍.jpg 三.工具类代码实现: public class GetPathFromUri4kitkat { @SuppressLint("NewApi") pub…
前言 数组的工具类java.util.Arrays 由于数组对象本身并没有什么方法可以供我们调用,但API中提供了一个工具类Arrays供我们使用,从而可以对数据对象进行一些基本的操作. 一.Arrays类概述 1.1.Arrays类的引入 该是java.util包中的类,在我们的代码中想使用这个类的话,就必须使用import进行导入. 在当前类A中,只有java.lang包下的类,以及和当前类A在同一个包下的类,不需要import引入之外,其他所有的包下的类在被使用之前都要import引入.…
一.Scanner类 1.api简介: 应用程序编程接口 2.Scanner类: 作用:获取键盘输入的数据 位置: java.util.Scanner. 使用:使用成员方法nextInt() 和 next() 分别接收整型和字符串类型数据 //将Scanner类实例化,并用System.in表示键盘输入 Scanner scanner = new Scanner(System.in); //使用成员方法nextInt() 和next() 分别接收整型和字符串类型数据 int num = scan…
前言 Java提供了一个操作Set.List和Map等集合的工具类:Collections,该工具类提供了大量方法对集合进行排序.查询和修改等操作, 还提供了将集合对象置为不可变.对集合对象实现同步控制等方法. 这个类不需要创建对象,内部提供的都是静态方法. 一.Collectios概述 api中的介绍: 一.排序操作 1.1.方法 1)static void reverse(List<?> list): 反转列表中元素的顺序. 2)static void shuffle(List<?&…
下方是一个很好的监测网络.状态的工具类 public class NetworkUtils { /** * 网络是否可用 * * @param activity * @return */ public static boolean isNetworkAvailable(Context context) { ConnectivityManager connectivity = (ConnectivityManager) context .getSystemService(Context.CONNE…
版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/aiyaya_/article/details/78975893前言在开发spring web项目时,我们很多的Controller层代码都需要获取一下,HttpServletRequest.HttpServletResponse和HttpSession等对象,我们普遍的方式是在Controller类下的方法参数中直接获取,例如: @Slf4j@ResponseResult@RestControll…
List集合的工具类(Collections): 注意:Collection是单列集合的根接口  Collections是操作集合对象的工具类 1.对list集合排序: sort(List) 根据自然特性排序 sort(List,Comaprator) 根据比较器排序 2.对集合list进行二分查找: int  binarySearch(List,key) int  binarySearch(List,key,Comaprator) 3.对集合取最大最小值: max(Collection) ma…
idea颜色说明http://blog.csdn.net/saindy5828/article/details/53319693 1,中途运用了properties,properties.getProperty这个方法没有的值的时候返回 "" 2,idea断点http://www.cnblogs.com/Bowu/p/4026117.html 3,java创建文件,说实话我这里忘记了, 重温一下,先要创建一个file,new File("").getAbsoluti…
package com; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; import org.junit.After; import org.junit.Before; import org.junit.Test; import com.entity.Food;…