mirror of
https://gitee.com/willfree/min-dev-java.git
synced 2026-10-04 19:42:01 +08:00
add error handle; VlInt
This commit is contained in:
1 parent
17e35f10d0
commit
de55943194
6 files changed
+131
-48
No files matched your search
@@ -21,6 +21,17 @@ import static org.junit.Assert.*;
|
||||
public class VlIntTest {
|
||||
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(VlIntTest.class);
|
||||
|
||||
// 测试
|
||||
public static void main(String[] args){
|
||||
// BigInteger bigInteger=new BigInteger("3");
|
||||
// VlInt vlInt=new VlInt(bigInteger);
|
||||
// System.out.println(vlInt.isEqual(2));
|
||||
byte[] b1 = new byte[]{(byte) 0xf1, (byte) 0xff, (byte) 0xff};//241,0,127
|
||||
VlInt start1 = new VlInt(b1);
|
||||
System.out.println("VlIntBytes:"+start1.getVlIntBytes().length);
|
||||
System.out.println("VlIntValue:"+start1.getVlIntValue());
|
||||
System.out.println(start1.toString());
|
||||
}
|
||||
|
||||
// @Test
|
||||
// public void size() {
|
||||
|
||||
@@ -214,18 +214,21 @@ import static org.junit.Assert.*;
|
||||
byte b3 = 0x7f;
|
||||
byte b4 = (byte) 0x80;
|
||||
byte b5 = (byte) 0xff;
|
||||
byte b6=(byte)0xf1;
|
||||
ByteHelper byteHelper = new ByteHelper();
|
||||
int a1 = byteHelper.uint8ToInt(b1);
|
||||
int a2 = byteHelper.uint8ToInt(b2);
|
||||
int a3 = byteHelper.uint8ToInt(b3);
|
||||
int a4 = byteHelper.uint8ToInt(b4);
|
||||
int a5 = byteHelper.uint8ToInt(b5);
|
||||
int a6=byteHelper.uint8ToInt(b6);
|
||||
|
||||
assertEquals(a1,0);
|
||||
assertEquals(a2,1);
|
||||
assertEquals(a3,127);
|
||||
assertEquals(a4,128);
|
||||
assertEquals(a5,255);
|
||||
assertEquals(a6,241);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in new issue
Block a user