| | |
| | | package com.ruoyi.utils.tools; |
| | | |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.lang.reflect.Field; |
| | | import java.text.DecimalFormat; |
| | | import java.time.LocalTime; |
| | |
| | | * @return |
| | | */ |
| | | public static String getKeyByMinValue(Map<String, Double> map) { |
| | | if (map == null) return null; |
| | | if (map == null||map.size()==0) return null; |
| | | List<Map.Entry<String, Double>> list = new ArrayList(map.entrySet()); |
| | | Collections.sort(list, (o1, o2) -> (o1.getValue().intValue() - o2.getValue().intValue())); |
| | | String min = list.get(0).getKey(); |
| | |
| | | int digitGroups = (int) (Math.log10(size) / Math.log10(1024)); |
| | | return new DecimalFormat("#,###.##").format(size / Math.pow(1024, digitGroups)) + " " + units[digitGroups]; |
| | | } |
| | | |
| | | /** |
| | | * byte数组转字符串 |
| | | * 刘苏义 |
| | | * 2023/10/18 8:42:59 |
| | | * @param byteArray |
| | | */ |
| | | public static String byteArrayToString(byte[] byteArray) { |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | for (byte b : byteArray) { |
| | | stringBuilder.append(String.valueOf(b)); |
| | | } |
| | | return stringBuilder.toString(); |
| | | } |
| | | } |