TestHutool.java

TestHutool.java

package hutool;

import java.util.Map;
import java.util.concurrent.TimeUnit;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.io.FileUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.extra.qrcode.QrCodeUtil;
import cn.hutool.http.HttpUtil;

/**
 * hutool工具类集合
 * 
 * @author ZengWenFeng
 * @date 2023.07.24
 * @email [email protected]
 * @mobile 13805029595
 */
public class TestHutool
{
	/*
	 * 
	
	
	cn.hutool
	hutool-all
	5.8.20
	
	
	https://www.hutool.cn/docs/#/
	https://apidoc.gitee.com/loolly/hutool/
	
	 * 
	 */
	public static void main(String[] args)
	{
		String md5 = SecureUtil.md5("ZengWenFeng".toString());
		System.out.println(md5);

		String httpGet = HttpUtil.get("https://www.baidu.com/");
		System.out.println(httpGet);

		User user = new User();
		user.setName("ZengWenFeng");
		Map map = BeanUtil.beanToMap(user);
		System.out.println(map);

		System.out.println(Convert.toInt("035"));

		String[] arr = {"1", "2", "3", "4"};
		System.out.println(Convert.toList(arr));

		String date = "2023-07-06";
		System.out.println(Convert.toDate(date));

		// 半角转全角
		String num = "123456";
		System.out.println(Convert.toSBC(num));

		// 全角转半角
		String num1 = "123456";
		System.out.println(Convert.toDBC(num1));

		//Unicode 字符串转换
		String con = "\\u5468\\u516d\\u8981\\u559d\\u9189";
		System.out.println(Convert.unicodeToStr(con));

		// 字符串转换为Unicode
		System.out.println(Convert.strToUnicode("ZENGWENFENG"));

		// 毫秒转换为分钟
		long t = 19299292;
		long minutes = Convert.convertTime(t, TimeUnit.MILLISECONDS, TimeUnit.MINUTES);
		System.out.println(minutes);

		double d = 67556.32;
		System.out.println(Convert.digitToChinese(d));

		QrCodeUtil.generate("https://hutool.cn/", 300, 300, FileUtil.file("d:/qrcode.jpg"));
	}
}

TestHutool.java_第1张图片

 

TestHutool.java_第2张图片

 

你可能感兴趣的:(java,java,hutool)