📄 codecs$hex.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3)
// Source File Name: Codecs.java
package com.sap.mw.jco.util;
// Referenced classes of package com.sap.mw.jco.util:
// Codecs
public static class Codecs$Hex
{
public static final String encode(byte value[])
{
if(value == null)
return "";
char s[] = new char[value.length * 2];
int i = 0;
int k = 0;
for(; i < value.length; i++)
{
s[k++] = hex[value[i] >> 4 & 0xf];
s[k++] = hex[value[i] & 0xf];
}
return new String(s);
}
public static final String encode(byte value)
{
char s[] = new char[2];
s[0] = hex[value >> 4 & 0xf];
s[1] = hex[value & 0xf];
return new String(s);
}
public static final String encode(char value)
{
char s[] = new char[4];
s[0] = hex[value >> 12 & 0xf];
s[1] = hex[value >> 8 & 0xf];
s[2] = hex[value >> 4 & 0xf];
s[3] = hex[value & 0xf];
return new String(s);
}
public static final String encode(int value)
{
char s[] = new char[8];
s[0] = hex[value >> 28 & 0xf];
s[1] = hex[value >> 24 & 0xf];
s[2] = hex[value >> 20 & 0xf];
s[3] = hex[value >> 16 & 0xf];
s[4] = hex[value >> 12 & 0xf];
s[5] = hex[value >> 8 & 0xf];
s[6] = hex[value >> 4 & 0xf];
s[7] = hex[value & 0xf];
return new String(s);
}
public static final byte[] decode(String value)
{
if(value == null)
{
return new byte[0];
} else
{
char chars[] = value.toCharArray();
return decode(chars, 0, chars.length);
}
}
public static final byte[] decode(char chars[], int offset, int length)
{
if(chars == null)
return new byte[0];
byte buf[] = new byte[(length + 1) / 2];
for(int i = 0; i < length; i++)
{
byte d = (byte)Character.digit(chars[offset + i], 16);
buf[i >> 1] |= d << (1 - (i & 1) << 2);
}
return buf;
}
private static char hex[] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'A', 'B', 'C', 'D', 'E', 'F'
};
public Codecs$Hex()
{
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -