Nicer code to calculate power of

This commit is contained in:
nicksavers 2014-05-22 10:42:56 +02:00
parent a0922f625c
commit dd45965240
2 changed files with 3 additions and 4 deletions

View File

@ -1,6 +1,5 @@
package org.ethereum.core;
import java.math.BigDecimal;
import java.math.BigInteger;
public enum Denomination {
@ -23,7 +22,7 @@ public enum Denomination {
return amount;
}
private static BigInteger newBigInt(double value) {
return BigDecimal.valueOf(Math.pow(10, value)).toBigInteger();
private static BigInteger newBigInt(int value) {
return BigInteger.valueOf(2).pow(value);
}
}

View File

@ -18,7 +18,7 @@ public class Genesis extends Block {
private static byte[] stateRoot = // TODO: Get stateRoot from actual state
Hex.decode("12582945fc5ad12c3e7b67c4fc37a68fc0d52d995bb7f7291ff41a2739a7ca16");
private static byte[] txTrieRoot = new byte[0];
private static byte[] difficulty = BigInteger.valueOf((long) Math.pow(2, 22)).toByteArray();
private static byte[] difficulty = BigInteger.valueOf(2).pow(22).toByteArray();
private static long number = 0;
private static long minGasPrice = 0;
private static long gasLimit = 1000000;