fixed VlInt.getVlInt()

This commit is contained in:
free will committed 2021-03-12 22:27:27 +08:00
1 parent 2ed9f7b030
commit 46d98cfa64
3 files changed
+11 -9

No files matched your search

+9 -8
View File
@@ -136,14 +136,11 @@ public class VlInt {
} }
/** /**
* 将vlint转为一个biginteger输出:需要判断size是不是等于9(9) * 将vlint转为一个biginteger输出
* @return * @return
*/ */
public BigInteger getVlIntValue(){ public BigInteger getVlIntValue(){
if(this.size()>=9){ return this.VlIntValue;
return VlIntValue;
}
return null;
} }
/** /**
@@ -268,8 +265,12 @@ public class VlInt {
// 测试 // 测试
public static void main(String[] args){ public static void main(String[] args){
BigInteger bigInteger=new BigInteger("3"); // BigInteger bigInteger=new BigInteger("3");
VlInt vlInt=new VlInt(bigInteger); // VlInt vlInt=new VlInt(bigInteger);
System.out.println(vlInt.isEqual(2)); // 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;国家重大科技基础设施——未来网络北大实验室;深圳市信息论与未来网络重点实验室 * @Copyright: MIN-Group;国家重大科技基础设施——未来网络北大实验室;深圳市信息论与未来网络重点实验室
*/ */
public class Packet { public class Packet {
} }
+1
View File
@@ -30,6 +30,7 @@ public class VlIntTest {
// public void createVlIntByBigInteger() { // public void createVlIntByBigInteger() {
// } // }
@Test @Test
public void getVlIntBytes() { public void getVlIntBytes() {
byte[] a = new byte[]{1,2,3,4}; byte[] a = new byte[]{1,2,3,4};