本文整理汇总了Java中com.qualcomm.robotcore.util.TypeConversion.unsignedByteToInt方法的典型用法代码示例。如果您正苦于以下问题:Java TypeConversion.unsignedByteToInt方法的具体用法?Java TypeConversion.unsignedByteToInt怎么用?Java TypeConversion.unsignedByteToInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.qualcomm.robotcore.util.TypeConversion
的用法示例。
在下文中一共展示了TypeConversion.unsignedByteToInt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: foundExpectedBytes
import com.qualcomm.robotcore.util.TypeConversion; //导入方法依赖的package包/类
private boolean foundExpectedBytes(int[] byteArray, Lock lock, byte[] cache) {
try {
lock.lock();
boolean allMatch = true;
StringBuilder s = new StringBuilder(300 * 4);
String mismatch = "";
for (int i = 0; i < byteArray.length; i++) {
s.append(String.format("expected: %02x, got: %02x \n", TypeConversion.unsignedByteToInt( (byte) byteArray[i]), cache[i]));
if (TypeConversion.unsignedByteToInt(cache[i]) != TypeConversion.unsignedByteToInt( (byte) byteArray[i])) {
mismatch = String.format("i: %d, byteArray[i]: %02x, cache[i]: %02x", i, byteArray[i], cache[i]);
allMatch = false;
}
}
RobotLog.e(s.toString() + "\n allMatch: " + allMatch + ", mismatch: " + mismatch);
return allMatch;
} finally {
lock.unlock();
}
}
示例2: notFoundExpectedBytes
import com.qualcomm.robotcore.util.TypeConversion; //导入方法依赖的package包/类
private boolean notFoundExpectedBytes(int[] byteArray, Lock lock, byte[] cache) {
try {
lock.lock();
boolean allMatch = true;
StringBuilder s = new StringBuilder(300 * 4);
String mismatch = "";
for (int i = 0; i < byteArray.length; i++) {
s.append(String.format("expected: %02x, got: %02x \n", TypeConversion.unsignedByteToInt((byte) byteArray[i]), cache[i]));
if (TypeConversion.unsignedByteToInt(cache[i]) != TypeConversion.unsignedByteToInt((byte) byteArray[i])) {
mismatch = String.format("i: %d, byteArray[i]: %02x, cache[i]: %02x", i, byteArray[i], cache[i]);
allMatch = false;
break;
}
}
RobotLog.e(s.toString() + "\n allMatch: " + allMatch + ", mismatch: " + mismatch);
return !allMatch;
} finally {
lock.unlock();
}
}
示例3: read8
import com.qualcomm.robotcore.util.TypeConversion; //导入方法依赖的package包/类
int read8(int ireg) {
byte b = this.i2cDeviceClient.read8(ireg);
return TypeConversion.unsignedByteToInt(b);
}