Here you can find the source of base128(BigInteger val)
Parameter | Description |
---|---|
val | a parameter |
public static ArrayList<Integer> base128(BigInteger val)
//package com.java2s; //License from project: Open Source License import java.math.BigInteger; import java.util.ArrayList; public class Main { public final static BigInteger BN127 = new BigInteger("127"); /**/*from w w w . j a v a 2s. c o m*/ * Convert to base 128 (bigendian), using shifts. * @param val * @return */ public static ArrayList<Integer> base128(BigInteger val) { ArrayList<Integer> result = new ArrayList<Integer>(); int part = val.and(BN127).intValue(); val = val.shiftRight(7); result.add(0, new Integer(part)); while (!val.equals(BigInteger.ZERO)) { part = val.and(BN127).intValue(); val = val.shiftRight(7); part += 128; result.add(0, new Integer(part)); } ; return result; } }