公告板
版本库
filestore
活动
搜索
登录
main
/
ytslOA-server
概况
操作记录
提交次数
目录
文档
派生
对比
blame
|
历史
|
原始文档
提交代码
唐耀东
2022-03-25
6f90df137a8577cb4716e43d01817c9ab0bb9096
[ytslOA-server.git]
/
ruoyi-common
/
src
/
main
/
java
/
com
/
ruoyi
/
common
/
utils
/
DataFormatUtils.java
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
package
com
.
ruoyi
.
common
.
utils
;
public
class
DataFormatUtils
{
/**
* 字符串转化成为16进制字符串
* @param s
* @return
*/
public
static
String
strTo16
(
String
s
)
{
String
str
=
""
;
for
(
int
i
=
0
;
i
<
s
.
length
();
i
++)
{
int
ch
=
(
int
)
s
.
charAt
(
i
);
String
s4
=
Integer
.
toHexString
(
ch
);
str
=
str
+
s4
;
}
return
str
;
}
public
static
String
padLeft
(
String
str
,
int
len
){
String
pad
=
"0000000000000000"
;
return
len
>
str
.
length
()&&
len
<=
16
&&
len
>=
0
?
pad
.
substring
(
0
,
len
-
str
.
length
())+
str
:
str
;
}
public
static
String
intToHex
(
int
n
)
{
StringBuffer
s
=
new
StringBuffer
();
String
a
;
char
[]
b
=
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
};
while
(
n
!=
0
){
s
=
s
.
append
(
b
[
n
%
16
]);
n
=
n
/
16
;
}
a
=
s
.
reverse
().
toString
();
return
a
;
}
}