当前位置: 首页>>代码示例>>Java>>正文


Java BigInteger.ZERO属性代码示例

本文整理汇总了Java中java.math.BigInteger.ZERO属性的典型用法代码示例。如果您正苦于以下问题:Java BigInteger.ZERO属性的具体用法?Java BigInteger.ZERO怎么用?Java BigInteger.ZERO使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.math.BigInteger的用法示例。


在下文中一共展示了BigInteger.ZERO属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: valInt

@Override
public BigInteger valInt() {
    long index = 0;
    String s = args.get(0).valStr();
    String source = args.get(1).valStr();
    if (args.get(0).isNull() || args.get(1).isNull()) {
        this.nullValue = true;
        return BigInteger.ZERO;
    }
    if (source.isEmpty())
        return BigInteger.ZERO;
    String[] ss = source.split(",");
    for (int i = 0; i < ss.length; ++i) {
        if (ss[i].equals(s)) {
            index = i + 1;
            break;
        }
    }
    return BigInteger.valueOf(index);
}
 
开发者ID:actiontech,项目名称:dble,代码行数:20,代码来源:ItemFuncFindInSet.java

示例2: set

/** Compute a coefficient in the internal table.
* @param n the zero-based index of the coefficient. n=0 for the E_0 term. 
* @author Richard J. Mathar
*/
protected void set(final int n)
{
        while ( n >= a.size())
        {
                BigInteger val = BigInteger.ZERO ;
                boolean sigPos = true; 
                int thisn = a.size() ;
                for(int i= thisn-1 ; i > 0 ; i--)
                {
                        BigInteger f = new BigInteger(""+ a.elementAt(i).toString() ) ;
                        f = f.multiply( BigIntegerMath.binomial(2*thisn,2*i) );
                        if ( sigPos )
                                val = val.add(f) ;
                        else
                                val = val.subtract(f) ;
                        sigPos = ! sigPos ;
                }
                if ( thisn % 2 ==0 )
                        val = val.subtract(BigInteger.ONE) ;
                else
                        val = val.add(BigInteger.ONE) ;
                a.add(val) ;
        }
}
 
开发者ID:Baizey,项目名称:Helpers,代码行数:28,代码来源:Euler.java

示例3: sizeOfDirectoryAsBigInteger

/**
 * Counts the size of a directory recursively (sum of the length of all files).
 *
 * @param directory directory to inspect, must not be {@code null}
 * @return size of directory in bytes, 0 if directory is security restricted.
 * @throws NullPointerException if the directory is {@code null}
 * @since 2.4
 */
public static BigInteger sizeOfDirectoryAsBigInteger(File directory) {
    checkDirectory(directory);

    final File[] files = directory.listFiles();
    if (files == null) {  // null if security restricted
        return BigInteger.ZERO;
    }
    BigInteger size = BigInteger.ZERO;

    for (final File file : files) {
        try {
            if (!isSymlink(file)) {
                size = size.add(BigInteger.valueOf(sizeOf(file)));
            }
        } catch (IOException ioe) {
            // Ignore exceptions caught when asking if a File is a symlink.
        }
    }

    return size;
}
 
开发者ID:wzx54321,项目名称:XinFramework,代码行数:29,代码来源:FileUtils.java

示例4: defineTypeSize

private void defineTypeSize(String macroName, int typeWidth, String valSuffix,
        boolean isSigned, StringBuilder buf)
{
    BigInteger maxVal;
    if (isSigned)
    {
        BigInteger one = BigInteger.ONE;
        maxVal = one.shiftLeft(typeWidth - 1).subtract(one);
    }
    else
    {
        BigInteger zero = BigInteger.ZERO;
        maxVal = zero.not().shiftRight(64 - typeWidth);
    }

    defineBuiltinMacro(buf, macroName + "=" + maxVal.toString(10) + valSuffix);
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:17,代码来源:PreprocessorFactory.java

示例5: createAccount

@Override
public synchronized AccountState createAccount(final byte[] addr) {
    AccountState accountState = new AccountState(BigInteger.ZERO, BigInteger.ZERO);
    updateAccountState(addr, accountState);
    updateContractDetails(addr, new ContractDetailsImpl(config));
    return accountState;
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:7,代码来源:RepositoryImpl.java

示例6: getBalances

/**
 * This may take a while, make sure you obey the limits of the api provider
 */
public BigInteger getBalances(List<String> contract) throws IOException {
    BigInteger result = BigInteger.ZERO;
    List<List<String>> part = Lists.partition(contract, 20);
    for(List<String> p:part) {
        result = result.add(get20Balances(p));
    }
    return result;
    //TODO:caching!
}
 
开发者ID:modum-io,项目名称:tokenapp-backend,代码行数:12,代码来源:Etherscan.java

示例7: valInt

@Override
public BigInteger valInt() {
    LongPtr year = new LongPtr(0);
    long week;
    MySQLTime ltime = new MySQLTime();
    if (getArg0Date(ltime, MyTime.TIME_NO_ZERO_DATE))
        return BigInteger.ZERO;
    week = MyTime.calcWeek(ltime, (MyTime.weekMode(args.size() > 1 ? args.get(1).valInt().intValue() : 0) | MyTime.WEEK_YEAR), year);
    return BigInteger.valueOf(week + year.get() * 100);
}
 
开发者ID:actiontech,项目名称:dble,代码行数:10,代码来源:ItemFuncYearweek.java

示例8: testValueOfBigInteger

public void testValueOfBigInteger() {
  BigInteger min = BigInteger.ZERO;
  BigInteger max = UnsignedLong.MAX_VALUE.bigIntegerValue();
  for (BigInteger big : TEST_BIG_INTEGERS) {
    boolean expectSuccess =
        big.compareTo(min) >= 0 && big.compareTo(max) <= 0;
    try {
      assertEquals(big, UnsignedLong.valueOf(big).bigIntegerValue());
      assertTrue(expectSuccess);
    } catch (IllegalArgumentException e) {
      assertFalse(expectSuccess);
    }
  }
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:14,代码来源:UnsignedLongTest.java

示例9: multiply

public static Multiplicity multiply( Multiplicity lhs, Multiplicity rhs ) {
    BigInteger min = lhs.min.multiply(rhs.min);
    BigInteger max;
    if (isZero(lhs.max) || isZero(rhs.max))
        max = BigInteger.ZERO;
    else
    if (lhs.max==null || rhs.max==null)
        max = null;
    else
        max = lhs.max.multiply(rhs.max);
    return create(min,max);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:Multiplicity.java

示例10: cmpDouble

private BigInteger cmpDouble() {
    double value = args.get(0).valReal().doubleValue();
    double a = args.get(1).valReal().doubleValue();
    double b = args.get(2).valReal().doubleValue();
    if (!args.get(1).isNull() && !args.get(2).isNull()) {
        return (value >= a && value <= b) != negated ? BigInteger.ONE : BigInteger.ZERO;
    }
    return varNullValue(value, a, b);
}
 
开发者ID:actiontech,项目名称:dble,代码行数:9,代码来源:ItemFuncBetweenAnd.java

示例11: valInt

@Override
public BigInteger valInt() {
    String s = args.get(0).valStr();
    if (args.get(0).isNull()) {
        this.nullValue = true;
        return BigInteger.ZERO;
    } else {
        if (s.length() == 0) {
            return BigInteger.ZERO;
        } else {
            return BigInteger.valueOf((int) s.charAt(0));
        }
    }
}
 
开发者ID:actiontech,项目名称:dble,代码行数:14,代码来源:ItemFuncAscii.java

示例12: dumpState

@SuppressWarnings("uncheked")
    public static void dumpState(ObjectNode statesNode, String address, AccountState state, ContractDetails details) {

        List<DataWord> storageKeys = new ArrayList<>(details.getStorage().keySet());
        Collections.sort(storageKeys);

        ObjectNode account = statesNode.objectNode();
        ObjectNode storage = statesNode.objectNode();

        for (DataWord key : storageKeys) {
            storage.put("0x" + Hex.toHexString(key.getData()),
                    "0x" + Hex.toHexString(details.getStorage().get(key).getNoLeadZeroesData()));
        }

        if (state == null)
            state = new AccountState(SystemProperties.getDefault().getBlockchainConfig().getCommonConstants().getInitialNonce(),
                    BigInteger.ZERO);

        account.put("balance", state.getBalance() == null ? "0" : state.getBalance().toString());
//        account.put("codeHash", details.getCodeHash() == null ? "0x" : "0x" + Hex.toHexString(details.getCodeHash()));
        account.put("code", details.getCode() == null ? "0x" : "0x" + Hex.toHexString(details.getCode()));
        account.put("nonce", state.getNonce() == null ? "0" : state.getNonce().toString());
        account.set("storage", storage);
        account.put("storage_root", state.getStateRoot() == null ? "" : Hex.toHexString(state.getStateRoot()));

        statesNode.set(address, account);
    }
 
开发者ID:talentchain,项目名称:talchain,代码行数:27,代码来源:JSONHelper.java

示例13: os2i

/** Convierte un Octet String de ASN&#46;1 en un entero
 * (seg&uacute;n <i>BSI TR 03111</i> Secci&oacute;n 3.1.2).
 * @param Octet String de ASN&#46;1.
 * @param offset posici&oacute;n de inicio-
 * @param length longitud del Octet String.
 * @return Entero (siempre positivo). */
private static BigInteger os2i(final byte[] bytes, final int offset, final int length) {
	if (bytes == null) {
		throw new IllegalArgumentException("El Octet String no puede ser nulo"); //$NON-NLS-1$
	}
	BigInteger result = BigInteger.ZERO;
	final BigInteger base = BigInteger.valueOf(256);
	for (int i = offset; i < offset + length; i++) {
		result = result.multiply(base);
		result = result.add(BigInteger.valueOf(bytes[i] & 0xFF));
	}
	return result;
}
 
开发者ID:MiFirma,项目名称:mi-firma-android,代码行数:18,代码来源:JseCryptoHelper.java

示例14: InterruptedExecutionBlockResult

public InterruptedExecutionBlockResult() {
    super(Collections.emptyList(), Collections.emptyList(), null, 0, BigInteger.ZERO);
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:3,代码来源:BlockResult.java

示例15: integerToBigInteger

private static BigInteger integerToBigInteger(ByteBuffer encoded) {
    if (!encoded.hasRemaining()) {
        return BigInteger.ZERO;
    }
    return new BigInteger(ByteBufferUtils.toByteArray(encoded));
}
 
开发者ID:F8LEFT,项目名称:FApkSigner,代码行数:6,代码来源:Asn1BerParser.java


注:本文中的java.math.BigInteger.ZERO属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。