blob: 13d73a3df6fe0369f4f9dc889626a84b580d9805 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
package Ic2ExpReactorPlanner;
import java.math.BigInteger;
/**
* Pulls values out of codes from Talonius's old reactor planner.
* @author Brian McCloud
*/
public class TaloniusDecoder {
private BigInteger dataStack = null;
public TaloniusDecoder(final String dataCode) {
dataStack = new BigInteger(dataCode, 36);
}
public int readInt(final int bits) {
return readBigInteger(bits).intValue();
}
private BigInteger readBigInteger(final int bits) {
BigInteger data = dataStack.and(BigInteger.ONE.shiftLeft(bits).subtract(BigInteger.ONE));
dataStack = dataStack.shiftRight(bits);
return data;
}
}
|