[英]i want to convert string and integer to unsigned byte
In java i have two variables 在java中我有两个变量
String string;
int integerValue;
I want to convert these values to unsignedbyte that is How to convert string to UnsignedByte and integer to UnsignedByte 我想将这些值转换为unsignedbyte,即如何将字符串转换为UnsignedByte,如何将整数转换为UnsignedByte
Java does not have an unsigned byte. Java没有无符号字节。
Converting from String to short
is done by Short.parseShort(string)
从String转换为
short
是通过Short.parseShort(string)
If you are referring to Axis's UnsignedByte
class, you can use the constructors: 如果要引用Axis的
UnsignedByte
类,则可以使用构造函数:
new UnsignedByte(sting);
new UnsignedByte(integerValue);
Java没有像无符号字节那样的类型,您必须为此使用更大的short(对于unsigned int,它必须是long)。
short s = (short) integerValue;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.