FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java-code-example/!temp/src/Test.java at master · cherkavi/java-code-example · GitHub
cherkavi
/
java-code-example
Public
Notifications
You must be signed in to change notification settings
Fork
4
Star
0
Code
Issues
0
Pull requests
42
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
java-code-example
/
!temp
/
src
/
Test.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
37 lines (32 loc) · 934 Bytes
Breadcrumbs
java-code-example
/
!temp
/
src
/
Test.java
Copy path
File metadata and controls
executable file
·
37 lines (32 loc) · 934 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
public
class
Test
{
public
Object
convert
(
Object
object_for_convert
) {
byte
[]
return_value
=
null
;
try
{
String
value
=(
String
)(
object_for_convert
);
return_value
=
hexToBytes
(
value
.
toCharArray
());
}
catch
(
Exception
ex
) {
}
return
return_value
;
}
// -- ïåðåâîä ñòðîêè char â áàéò ìàññèâ
public
byte
[]
hexToBytes
(
char
[]
hex
) {
int
length
=
hex
.
length
/
2
;
byte
[]
res
=
new
byte
[
length
];
for
(
int
i
=
0
;
i
<
length
;
i
++) {
int
high
=
Character
.
digit
(
hex
[
i
*
2
],
16
);
int
low
=
Character
.
digit
(
hex
[
i
*
2
+
1
],
16
);
int
value
= (
high
<<
4
) |
low
;
if
(
value
>
127
)
value
-=
256
;
res
[
i
] = (
byte
)
value
;
}
return
res
;
}
public
static
void
main
(
String
[]
args
) {
Test
test
=
new
Test
();
byte
[]
value
=(
byte
[])
test
.
convert
(
"80F6001001"
);
for
(
int
counter
=
0
;
counter
<
value
.
length
;
counter
++){
System
.
out
.
println
(
counter
+
":"
+
value
[
counter
]);
}
}
}
Back
|
FazBrowse Home
|
New Git URL