Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ioc_sixiang_license
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zengtianlai3
ioc_sixiang_license
Commits
04b6fa6f
Commit
04b6fa6f
authored
Jul 07, 2022
by
zengtianlai3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2.3.6 代码质量:循环中拼接字符串
parent
8e4794fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
HexUtil.java
license/src/main/java/iot/sixiang/license/util/HexUtil.java
+4
-4
No files found.
license/src/main/java/iot/sixiang/license/util/HexUtil.java
View file @
04b6fa6f
...
...
@@ -4,13 +4,13 @@ public class HexUtil {
public
static
String
bytes2hex
(
byte
[]
bytes
)
{
StringBuilder
sb
=
new
StringBuilder
();
String
tmp
;
String
Builder
tmp
;
sb
.
append
(
"["
);
for
(
byte
b
:
bytes
)
{
// 将每个字节与0xFF进行与运算,然后转化为10进制,然后借助于Integer再转化为16进制
tmp
=
Integer
.
toHexString
(
0xFF
&
b
);
tmp
=
new
StringBuilder
(
Integer
.
toHexString
(
0xFF
&
b
)
);
if
(
tmp
.
length
()
==
1
)
{
tmp
=
"0"
+
tmp
;
//只有一位的前面补个0
tmp
=
tmp
.
insert
(
0
,
'0'
)
;
//只有一位的前面补个0
}
sb
.
append
(
tmp
).
append
(
" "
);
//每个字节用空格断开
}
...
...
@@ -18,4 +18,4 @@ public class HexUtil {
sb
.
append
(
"]"
);
return
sb
.
toString
();
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment