1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
| package com.whyc.util;
|
| import com.whyc.service.OperationLogService;
| import org.springframework.stereotype.Component;
|
| /**
| * 通用工具列
| */
| @Component
| public class CommonUtil {
|
| private static OperationLogService service;
| //将数转换成二进制字符串并统计1的个数
| public static int getIntToBinary(int switchState,int[] bit){
| int count=0;
| if(bit.length>0){
| for (int i=0;i<bit.length;i++){
| int ss=switchState&(1<<bit[i]);
| if(ss>0){
| count++;
| }
| }
| }
| return count;
| }
|
| /**
| * 手动记录特定日志
| */
| public static void record(int type1,int type2, String msg, String msgDetail) {
| service.record(type1, type2, msg, msgDetail);
| }
|
|
|
|
| }
|
|