我想将字符串和整数转换为无符号字节

时间:2010-07-28 12:50:03

标签: java memory

在java中 我有两个变量

String string;
int integerValue;

我想将这些值转换为unsignedbyte 那是 如何将字符串转换为UnsignedByte 和 整数到UnsignedByte

2 个答案:

答案 0 :(得分:1)

Java没有无符号字节。

从字符串转换为shortShort.parseShort(string)

完成

如果您指的是Axis的UnsignedByte类,您可以使用构造函数:

new UnsignedByte(sting);
new UnsignedByte(integerValue);

答案 1 :(得分:0)

Java没有像unsigned byte这样的类型,你必须使用更大的short(对于unsigned int,它必须很长)。

short s = (short) integerValue;