随笔分类 - Java
摘要:package com.lbdz.common.utils; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.regex.Mat
阅读全文
摘要://字符串集合 BigDecimal sum = strList.stream().map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add); //对象集合 BigDecimal sumValue = list.stream().ma
阅读全文
摘要:struts2上传文件时,超过了默认文件大小 查看struts.properties配置文件(默认2M) 修改文件大小(例如100M)struts.multipart.maxSize=104857600
阅读全文
摘要:List<Integer> list = new ArrayList<>(); int size = list.size(); int batchSize = 10; for (int i = 0; i < size; i += batchSize) { int fromIndex = i; int
阅读全文
摘要:String str = "(20/84)*100"; ScriptEngine se = new ScriptEngineManager().getEngineByName("JavaScript"); try { Object eval = se.eval(str); System.out.pr
阅读全文
摘要:BigDecimal decimal = new BigDecimal("3.116"); //四舍五入(>=5进位) BigDecimal decimal1 = decimal.setScale(2, BigDecimal.ROUND_HALF_UP); //四舍五入(>5进位) BigDecim
阅读全文
摘要:List<Integer> list = new ArrayList<>(); list.add(1); list.add(2); list.add(3); //是否至少一个元素满足 boolean match = list.stream().anyMatch(i -> i > 2 && i < 6
阅读全文
摘要:List<String> list = new ArrayList<>(); List<BigDecimal> newList = list.stream().map(BigDecimal::new).collect(Collectors.toList());
阅读全文
摘要:Map<String, List<OperationNodeVo>> listMap = nodeVoList.stream().collect(Collectors.groupingBy(OperationNodeVo::getNodeCode));
阅读全文
摘要:List<Map<String, Object>> list = new ArrayList<>(); Map<String, Object> map1 = new HashMap<>(); map1.put("name", "苹果"); map1.put("code", "apple"); lis
阅读全文
摘要:/** * 返回中文的首字母 */ public static String getPinYinHeadChar(String str) { String sb = ""; for (int j = 0; j < str.length(); j++) { char word = str.charAt
阅读全文
摘要:31-Jan-2024 14:01:13.812 信息 [main] org.apache.coyote.AbstractProtocol.start 开始协议处理句柄["http-nio-8080"] 31-Jan-2024 14:01:13.818 严重 [main] org.apache.ca
阅读全文
摘要:List<Map<String,Object>> list = new ArrayList<>(); Map<String,Object> map1 = new HashMap<>(); map1.put("code","01"); map1.put("name","小张"); map1.put("
阅读全文
摘要://字符串转json数组 String str = "[{\"code\":\"0001\",\"name\":\"050\"},{\"code\":\"0002\",\"name\":\"185\"}]"; JSONArray deptArray = JSONArray.parseArray(st
阅读全文
摘要:1、依赖sun.misc.BASE64Decoder.jar /** * Base64编码 * @param data 要加密的字符数组 * @return String 加密后的16进制字符串 */ public static String encode(byte[] data){ return
阅读全文
摘要:/** * request中参数转换成map */ public static Map<String, String> requestParamsToMap(HttpServletRequest request) { Map<String, String> reqMap = new HashMap<
阅读全文
摘要:<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <webResources> <resource> <!--打包时将lib里面
阅读全文
摘要:package com.lbdz.bsf.util; import net.sf.json.JSONObject; import net.sf.json.JSONSerializer; import net.sf.json.xml.XMLSerializer; /** * xml和json转换 */
阅读全文
摘要:BigDecimal a = new BigDecimal(10); BigDecimal b = new BigDecimal(2); if(a.compareTo(b) == 0){ System.out.println("a等于b"); } if(a.compareTo(b) == 1){ S
阅读全文
摘要:/** * 自适应列宽 * @param sheet * @param columnLength 列数 */ private static void setSizeColumn(HSSFSheet sheet, int columnLength) { for (int columnNum = 0;
阅读全文