derinteger.java

来自「《移动Agent技术》一书的所有章节源代码。」· Java 代码 · 共 50 行

JAVA
50
字号
package org.bouncycastle.asn1;import java.io.*;import java.math.BigInteger;public class DERInteger    extends DERObject{    byte[]      bytes;    public DERInteger(        int         value)    {        bytes = BigInteger.valueOf(value).toByteArray();    }    public DERInteger(        BigInteger   value)    {        bytes = value.toByteArray();    }    public DERInteger(        byte[]   bytes)    {        this.bytes = bytes;    }    public BigInteger getValue()    {        return new BigInteger(bytes);    }    /**     * in some cases positive values get crammed into a space,     * that's not quite big enough...     */    public BigInteger getPositiveValue()    {        return new BigInteger(1, bytes);    }    void encode(        DEROutputStream out)        throws IOException    {        out.writeEncoded(INTEGER, bytes);    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?