fixed VlInt.getVlInt()

This commit is contained in:
free will
2021-03-12 22:27:27 +08:00
parent 2ed9f7b030
commit 46d98cfa64
3 changed files with 11 additions and 9 deletions
+9 -8
View File
@@ -136,14 +136,11 @@ public class VlInt {
}
/**
* 将vlint转为一个biginteger输出:需要判断size是不是等于9(9)
* 将vlint转为一个biginteger输出
* @return
*/
public BigInteger getVlIntValue(){
if(this.size()>=9){
return VlIntValue;
}
return null;
return this.VlIntValue;
}
/**
@@ -268,8 +265,12 @@ public class VlInt {
// 测试
public static void main(String[] args){
BigInteger bigInteger=new BigInteger("3");
VlInt vlInt=new VlInt(bigInteger);
System.out.println(vlInt.isEqual(2));
// BigInteger bigInteger=new BigInteger("3");
// VlInt vlInt=new VlInt(bigInteger);
// System.out.println(vlInt.isEqual(2));
byte[] b1 = new byte[]{(byte) 0xf1,0x00,0x7f};//241,0,127
VlInt start1 = new VlInt(b1);
System.out.println("VlIntBytes:"+start1.getVlIntBytes().length);
System.out.println("VlIntValue:"+start1.getVlIntValue());
}
}
+1 -1
View File
@@ -8,5 +8,5 @@ package packet;
* @Copyright: MIN-Group;国家重大科技基础设施——未来网络北大实验室;深圳市信息论与未来网络重点实验室
*/
public class Packet {
}
+1
View File
@@ -30,6 +30,7 @@ public class VlIntTest {
// public void createVlIntByBigInteger() {
// }
@Test
public void getVlIntBytes() {
byte[] a = new byte[]{1,2,3,4};