Example usage for java.math BigInteger valueOf

List of usage examples for java.math BigInteger valueOf

Introduction

In this page you can find the example usage for java.math BigInteger valueOf.

Prototype

private static BigInteger valueOf(int val[]) 

Source Link

Document

Returns a BigInteger with the given two's complement representation.

Usage

From source file:de.urszeidler.ethereum.licencemanager1.deployer.LicenseManagerDeployerTest.java

@Test
public void testCreateIssuerContract() throws IOException, InterruptedException, ExecutionException {
    testDeployLicenseManager_intern();/*from  www .  ja  va 2  s.c  o m*/

    String itemName = "item name";
    String textHash = "text hash";
    String url = "the url";
    Integer lifeTime = 0;
    Integer price = 2;
    managerDeployer.createIssuerContract(itemName, textHash, url, lifeTime, price);
    DeployDuo<LicenseManager> licenseManager = managerDeployer.getLicenseManager();

    assertEquals(1, licenseManager.contractInstance.contractCount().intValue());
    LicenseIssuer licenseIssuer = deployer.createLicenseIssuerProxy(sender,
            licenseManager.contractInstance.contracts(0));

    assertEquals(itemName, licenseIssuer.licensedItemName());
    assertEquals(textHash, licenseIssuer.licenseTextHash());
    assertEquals(url, licenseIssuer.licenseUrl());
    assertEquals(lifeTime, licenseIssuer.licenseLifetime());
    assertEquals(BigInteger.valueOf(price * LicenseManagerDeployer.FINNEY_TO_WEI),
            licenseIssuer.licencePrice());
    assertEquals(0, licenseIssuer.licenseCount().intValue());
}

From source file:org.tsm.concharto.dao.UserTagDaoHib.java

@SuppressWarnings("unchecked")
public List<TagCloudEntry> getTagCountsByEventBeginDate(TimeRange timeRange) {
    Date start = timeRange.getBegin().getDate();
    Date end = timeRange.getEnd().getDate();
    List<TagCloudEntry> list = getSessionFactory().getCurrentSession()
            .createSQLQuery(SQL_TAG_COUNTS_BY_EVENT_DATE)
            .setResultTransformer(Transformers.aliasToBean(TagCloudEntry.class))
            .setBigInteger("start", BigInteger.valueOf(start.getTime()))
            .setBigInteger("end", BigInteger.valueOf(end.getTime())).list();
    return list;/*from   w w  w .  j a va 2s .c o m*/
}

From source file:com.dulion.astatium.mesh.shredder.ContextManager.java

public ContextManager(ContextLoader contextLoader, ContextBuilder contextBuilder) {
    this.contextLoader = contextLoader;
    this.contextBuilder = contextBuilder;
    Range range = new RationalRange(BigInteger.valueOf(2), BigInteger.ONE);

    ContextData context = ContextData.builder().contextId(0).namespace("urn:com:expedia:fcts:booking")
            .name("Base").type(ContextType.BASE).build();

    root = new ContextBase(context, range);
}

From source file:de.jfachwert.post.Postfach.java

/**
 * Erzeugt ein Postfach.//from w  w  w.  ja v a  2s .  c o  m
 *
 * @param nummer positive Zahl ohne fuehrende Null
 * @param ort gueltiger Ort mit PLZ
 */
public Postfach(long nummer, Ort ort) {
    this(BigInteger.valueOf(nummer), ort);
}

From source file:be.fedict.eid.tsl.BelgianTrustServiceListFactory.java

/**
 * Creates a new instance of a trust service list for Belgium according to
 * the given time frame./*ww w.  ja va2 s . c o m*/
 * 
 * @param year
 *            the year for which the TSL should be valid.
 * @param trimester
 *            the trimester for which the TSL should be valid.
 * @return the trust service list object.
 */
public static TrustServiceList newInstance(int year, Trimester trimester) {
    if (2010 != year && 2011 != year && 2012 != year && 2013 != year && 2014 != year && 2015 != year) {
        throw new IllegalArgumentException(
                "cannot create a TSL for year (NEW): " + year + " trimester " + trimester);
    }

    BigInteger tslSequenceNumber;
    DateTime listIssueDateTime;
    Document euTSLDocument;
    X509Certificate euSSLCertificate = null;

    // setup
    TrustServiceList trustServiceList = TrustServiceListFactory.newInstance();
    setupTSL(trustServiceList);

    // trust service provider list: certipost
    LOG.debug("Create TSP: Certipost");
    TrustServiceProvider certipostTrustServiceProvider = createTSP_certipost();
    LOG.debug("Add TSP_certipost to Trustlist");
    trustServiceList.addTrustServiceProvider(certipostTrustServiceProvider);

    // Certipost trust services: Root CA and Root CA2
    LOG.debug("Add Trustservice BRCA1 to TSP_Certipost");
    certipostTrustServiceProvider.addTrustService(createTSPService_BRCA1());
    LOG.debug("Add Trustservice BRCA2 to TSP_Certipost");
    certipostTrustServiceProvider.addTrustService(createTSPService_BRCA2());

    if (2010 == year) {
        switch (trimester) {
        case FIRST:
            tslSequenceNumber = BigInteger.valueOf(1);
            listIssueDateTime = new DateTime(2010, 1, 1, 0, 0, 0, 0, DateTimeZone.UTC);
            euTSLDocument = loadDocumentFromResource("eu/tl-mp.xml");
            break;
        case SECOND:
            tslSequenceNumber = BigInteger.valueOf(2);
            listIssueDateTime = new DateTime(2010, 5, 1, 0, 0, 0, 0, DateTimeZone.UTC);
            euTSLDocument = loadDocumentFromResource("eu/tl-mp-2.xml");
            break;
        case THIRD:
            tslSequenceNumber = BigInteger.valueOf(3);
            listIssueDateTime = new DateTime(2010, 9, 1, 0, 0, 0, 0, DateTimeZone.UTC);
            euTSLDocument = loadDocumentFromResource("eu/tl-mp-2.xml");
            break;
        default:
            throw new IllegalArgumentException(trimester.toString());
        }
    } else if (2011 == year) {
        // year == 2011
        switch (trimester) {
        case FIRST:
            tslSequenceNumber = BigInteger.valueOf(4);
            listIssueDateTime = new DateTime(2011, 1, 1, 0, 0, 0, 0, DateTimeZone.UTC);
            euTSLDocument = loadDocumentFromResource("eu/tl-mp-2.xml");
            euSSLCertificate = loadCertificateFromResource("eu/ec.europa.eu.der");
            break;
        case SECOND:
            tslSequenceNumber = BigInteger.valueOf(5);
            listIssueDateTime = new DateTime(2011, 5, 1, 0, 0, 0, 0, DateTimeZone.UTC);
            euTSLDocument = loadDocumentFromResource("eu/tl-mp-2.xml");
            euSSLCertificate = loadCertificateFromResource("eu/ec.europa.eu.der");
            break;
        case THIRD:
            tslSequenceNumber = BigInteger.valueOf(6);
            listIssueDateTime = new DateTime(2011, 9, 1, 0, 0, 0, 0, DateTimeZone.UTC);
            euTSLDocument = loadDocumentFromResource("eu/tl-mp-2.xml");
            euSSLCertificate = loadCertificateFromResource("eu/ec.europa.eu.der");
            break;
        default:
            throw new IllegalArgumentException(trimester.toString());
        }
    } else if (2012 == year) {
        // year == 2012
        switch (trimester) {
        case FIRST:
            tslSequenceNumber = BigInteger.valueOf(7);
            listIssueDateTime = new DateTime(2012, 1, 1, 0, 0, 0, 0, DateTimeZone.UTC);
            euTSLDocument = loadDocumentFromResource("eu/tl-mp-2.xml");
            euSSLCertificate = loadCertificateFromResource("eu/ec.europa.eu.der");
            break;
        case SECOND: {
            tslSequenceNumber = BigInteger.valueOf(8);
            listIssueDateTime = new DateTime(2012, 5, 1, 0, 0, 0, 0, DateTimeZone.UTC);
            euTSLDocument = loadDocumentFromResource("eu/tl-mp-33.xml");
            euSSLCertificate = loadCertificateFromResource("eu/ec.europa.eu.der");

            createTSPService_AdditionelServices_Certipost(certipostTrustServiceProvider);
            break;
        }
        case THIRD: {
            tslSequenceNumber = BigInteger.valueOf(9);
            listIssueDateTime = new DateTime(2012, 9, 1, 0, 0, 0, 0, DateTimeZone.UTC);
            euTSLDocument = loadDocumentFromResource("eu/tl-mp-33.xml");
            euSSLCertificate = loadCertificateFromResource("eu/ec.europa.eu.der");

            createTSPService_AdditionelServices_Certipost(certipostTrustServiceProvider);
            break;
        }
        default:
            throw new IllegalArgumentException(trimester.toString());
        }
    } else if (2013 == year) {
        switch (trimester) {
        case FIRST: {
            tslSequenceNumber = BigInteger.valueOf(10);
            listIssueDateTime = new DateTime(2013, 1, 1, 0, 0, 0, 0, DateTimeZone.UTC);
            euTSLDocument = loadDocumentFromResource("eu/tl-mp-33.xml");
            euSSLCertificate = loadCertificateFromResource("eu/ec.europa.eu.der");

            createTSPService_AdditionelServices_Certipost(certipostTrustServiceProvider);
            break;
        }
        case SECOND: {
            tslSequenceNumber = BigInteger.valueOf(11);
            listIssueDateTime = new DateTime(2013, 5, 1, 0, 0, 0, 0, DateTimeZone.UTC);
            euTSLDocument = loadDocumentFromResource("eu/tl-mp-33.xml");
            euSSLCertificate = loadCertificateFromResource("eu/ec.europa.eu.der");

            createTSPService_AdditionelServices_Certipost(certipostTrustServiceProvider);
            break;
        }
        case THIRD: {
            tslSequenceNumber = BigInteger.valueOf(12);
            listIssueDateTime = new DateTime(2013, 9, 1, 0, 0, 0, 0, DateTimeZone.UTC);
            euTSLDocument = loadDocumentFromResource("eu/tl-mp-33.xml");
            euSSLCertificate = loadCertificateFromResource("eu/ec.europa.eu.2013-2015.der");

            // BRCA 3 en BRCA 4
            LOG.debug("Add Trustservice BRCA3 to TSP_Certipost");
            certipostTrustServiceProvider.addTrustService(createTSPService_BRCA3());
            LOG.debug("Add Trustservice BRCA4 to TSP_Certipost");
            certipostTrustServiceProvider.addTrustService(createTSPService_BRCA4());

            createTSPService_AdditionelServices_Certipost(certipostTrustServiceProvider);

            // SWIFT
            LOG.debug("Create TSP: Swift");
            TrustServiceProvider swiftTrustServiceProvider = createTSP_swift();
            LOG.debug("Add TSP_swift to Trustlist");
            trustServiceList.addTrustServiceProvider(swiftTrustServiceProvider);
            LOG.debug("Add Trustservice SwiftNetPKI to TSP_Swift");
            swiftTrustServiceProvider.addTrustService(createTSPService_SWIFTNetPKI());

            break;
        }
        default:
            throw new IllegalArgumentException(trimester.toString());
        }
    } else if (2014 == year) {
        switch (trimester) {
        case FIRST: {
            tslSequenceNumber = BigInteger.valueOf(16);
            listIssueDateTime = new DateTime(2014, 2, 14, 0, 0, 0, 0, DateTimeZone.UTC);
            euTSLDocument = loadDocumentFromResource("eu/tl-mp-33.xml");
            euSSLCertificate = loadCertificateFromResource("eu/ec.europa.eu.2013-2015.der");

            // BRCA 3 en BRCA 4
            LOG.debug("Add Trustservice BRCA3 to TSP_Certipost");
            certipostTrustServiceProvider.addTrustService(createTSPService_BRCA3());
            LOG.debug("Add Trustservice BRCA4 to TSP_Certipost");
            certipostTrustServiceProvider.addTrustService(createTSPService_BRCA4());

            createTSPService_AdditionelServices_Certipost(certipostTrustServiceProvider);

            // SWIFT
            LOG.debug("Create TSP: Swift");
            TrustServiceProvider swiftTrustServiceProvider = createTSP_swift();
            LOG.debug("Add TSP_swift to Trustlist");
            trustServiceList.addTrustServiceProvider(swiftTrustServiceProvider);
            LOG.debug("Add Trustservice SwiftNetPKI to TSP_Swift");
            swiftTrustServiceProvider.addTrustService(createTSPService_SWIFTNetPKI());
            break;
        }
        case SECOND: {
            tslSequenceNumber = BigInteger.valueOf(17);
            listIssueDateTime = new DateTime(2014, 6, 20, 0, 0, 0, 0, DateTimeZone.UTC);
            euTSLDocument = loadDocumentFromResource("eu/tl-mp-33.xml");
            euSSLCertificate = loadCertificateFromResource("eu/ec.europa.eu.2013-2015.der");

            // BRCA 3 en BRCA 4
            LOG.debug("Add Trustservice BRCA3 to TSP_Certipost");
            certipostTrustServiceProvider.addTrustService(createTSPService_BRCA3());
            LOG.debug("Add Trustservice BRCA4 to TSP_Certipost");
            certipostTrustServiceProvider.addTrustService(createTSPService_BRCA4());

            createTSPService_AdditionelServices_Certipost(certipostTrustServiceProvider);

            // SWIFT
            LOG.debug("Create TSP: Swift");
            TrustServiceProvider swiftTrustServiceProvider = createTSP_swift();
            LOG.debug("Add TSP_swift to Trustlist");
            trustServiceList.addTrustServiceProvider(swiftTrustServiceProvider);
            LOG.debug("Add Trustservice SwiftNetPKI to TSP_Swift");
            swiftTrustServiceProvider.addTrustService(createTSPService_SWIFTNetPKI());
            break;
        }
        case THIRD: {
            tslSequenceNumber = BigInteger.valueOf(19);
            listIssueDateTime = new DateTime(2014, 10, 9, 0, 0, 0, 0, DateTimeZone.UTC);
            euTSLDocument = loadDocumentFromResource("eu/tl-mp-33.xml");
            euSSLCertificate = loadCertificateFromResource("eu/ec.europa.eu.2013-2015.der");

            // BRCA 3 en BRCA 4
            LOG.debug("Add Trustservice BRCA3 to TSP_Certipost");
            certipostTrustServiceProvider.addTrustService(createTSPService_BRCA3());
            LOG.debug("Add Trustservice BRCA4 to TSP_Certipost");
            certipostTrustServiceProvider.addTrustService(createTSPService_BRCA4());

            createTSPService_AdditionelServices_Certipost(certipostTrustServiceProvider);

            // SWIFT
            LOG.debug("Create TSP: Swift");
            TrustServiceProvider swiftTrustServiceProvider = createTSP_swift();
            LOG.debug("Add TSP_swift to Trustlist");
            trustServiceList.addTrustServiceProvider(swiftTrustServiceProvider);
            LOG.debug("Add Trustservice SwiftNetPKI to TSP_Swift");
            swiftTrustServiceProvider.addTrustService(createTSPService_SWIFTNetPKI());

            //Quovadis
            LOG.debug("Create TSP Qua Vadis");
            TrustServiceProvider quovadisTrustServiceProvider = createTSP_Quovadis();
            LOG.debug("Add TSP_QuoVadis to Trustlist");
            trustServiceList.addTrustServiceProvider(quovadisTrustServiceProvider);
            LOG.debug("Add QuoVadis BE PKI CertificationAuthority");
            quovadisTrustServiceProvider
                    .addTrustService(createTSPService_QuoVadisBEPKICertificationAuthority());

            break;
        }
        default:
            throw new IllegalArgumentException(trimester.toString());
        }
    } else if (2015 == year) {
        switch (trimester) {
        case FIRST: {
            tslSequenceNumber = BigInteger.valueOf(20);
            listIssueDateTime = new DateTime(2015, 2, 19, 0, 0, 0, 0, DateTimeZone.UTC);
            euTSLDocument = loadDocumentFromResource("eu/tl-mp-33.xml");
            euSSLCertificate = loadCertificateFromResource("eu/ec.europa.eu.2013-2015.der");

            // BRCA 3 en BRCA 4
            LOG.debug("Add Trustservice BRCA3 to TSP_Certipost");
            certipostTrustServiceProvider.addTrustService(createTSPService_BRCA3());
            LOG.debug("Add Trustservice BRCA4 to TSP_Certipost");
            certipostTrustServiceProvider.addTrustService(createTSPService_BRCA4());

            createTSPService_AdditionelServices_Certipost(certipostTrustServiceProvider);

            // SWIFT
            LOG.debug("Create TSP: Swift");
            TrustServiceProvider swiftTrustServiceProvider = createTSP_swift();
            LOG.debug("Add TSP_swift to Trustlist");
            trustServiceList.addTrustServiceProvider(swiftTrustServiceProvider);
            LOG.debug("Add Trustservice SwiftNetPKI to TSP_Swift");
            swiftTrustServiceProvider.addTrustService(createTSPService_SWIFTNetPKI());

            //Quovadis
            LOG.debug("Create TSP Qua Vadis");
            TrustServiceProvider quovadisTrustServiceProvider = createTSP_Quovadis();
            LOG.debug("Add TSP_QuoVadis to Trustlist");
            trustServiceList.addTrustServiceProvider(quovadisTrustServiceProvider);
            LOG.debug("Add QuoVadis BE PKI CertificationAuthority");
            quovadisTrustServiceProvider
                    .addTrustService(createTSPService_QuoVadisBEPKICertificationAuthority());

            break;
        }
        case SECOND: {
            tslSequenceNumber = BigInteger.valueOf(21);
            listIssueDateTime = new DateTime(2015, 6, 25, 0, 0, 0, 0, DateTimeZone.UTC);
            euTSLDocument = loadDocumentFromResource("eu/tl-mp-33.xml");
            euSSLCertificate = loadCertificateFromResource("eu/ec.europa.eu.2013-2015.der");

            // BRCA 3 en BRCA 4
            LOG.debug("Add Trustservice BRCA3 to TSP_Certipost");
            certipostTrustServiceProvider.addTrustService(createTSPService_BRCA3());
            LOG.debug("Add Trustservice BRCA4 to TSP_Certipost");
            certipostTrustServiceProvider.addTrustService(createTSPService_BRCA4());

            createTSPService_AdditionelServices_Certipost(certipostTrustServiceProvider);

            // SWIFT
            LOG.debug("Create TSP: Swift");
            TrustServiceProvider swiftTrustServiceProvider = createTSP_swift();
            LOG.debug("Add TSP_swift to Trustlist");
            trustServiceList.addTrustServiceProvider(swiftTrustServiceProvider);
            LOG.debug("Add Trustservice SwiftNetPKI to TSP_Swift");
            swiftTrustServiceProvider.addTrustService(createTSPService_SWIFTNetPKI());

            //Quovadis
            LOG.debug("Create TSP Qua Vadis");
            TrustServiceProvider quovadisTrustServiceProvider = createTSP_Quovadis();
            LOG.debug("Add TSP_QuoVadis to Trustlist");
            trustServiceList.addTrustServiceProvider(quovadisTrustServiceProvider);
            LOG.debug("Add QuoVadis BE PKI CertificationAuthority");
            quovadisTrustServiceProvider
                    .addTrustService(createTSPService_QuoVadisBEPKICertificationAuthority());

            break;
        }
        case THIRD: {
            tslSequenceNumber = BigInteger.valueOf(22);
            listIssueDateTime = new DateTime(2015, 11, 5, 0, 0, 0, 0, DateTimeZone.UTC);
            euTSLDocument = loadDocumentFromResource("eu/tl-mp-33.xml");
            euSSLCertificate = loadCertificateFromResource("eu/ec.europa.eu.2013-2015.der");

            // BRCA 3 en BRCA 4
            LOG.debug("Add Trustservice BRCA3 to TSP_Certipost");
            certipostTrustServiceProvider.addTrustService(createTSPService_BRCA3());
            LOG.debug("Add Trustservice BRCA4 to TSP_Certipost");
            certipostTrustServiceProvider.addTrustService(createTSPService_BRCA4());

            createTSPService_AdditionelServices_Certipost(certipostTrustServiceProvider);

            // SWIFT
            LOG.debug("Create TSP: Swift");
            TrustServiceProvider swiftTrustServiceProvider = createTSP_swift();
            LOG.debug("Add TSP_swift to Trustlist");
            trustServiceList.addTrustServiceProvider(swiftTrustServiceProvider);
            LOG.debug("Add Trustservice SwiftNetPKI to TSP_Swift");
            swiftTrustServiceProvider.addTrustService(createTSPService_SWIFTNetPKI());

            //Quovadis
            LOG.debug("Create TSP Qua Vadis");
            TrustServiceProvider quovadisTrustServiceProvider = createTSP_Quovadis();
            LOG.debug("Add TSP_QuoVadis to Trustlist");
            trustServiceList.addTrustServiceProvider(quovadisTrustServiceProvider);
            LOG.debug("Add QuoVadis BE PKI CertificationAuthority");
            quovadisTrustServiceProvider
                    .addTrustService(createTSPService_QuoVadisBEPKICertificationAuthority());

            break;
        }
        default:
            throw new IllegalArgumentException(trimester.toString());
        }
    } else {
        throw new IllegalArgumentException("unsupported year");
    }

    //set sequencenumber
    trustServiceList.setTSLSequenceNumber(tslSequenceNumber);
    //set issuedate
    trustServiceList.setListIssueDateTime(listIssueDateTime);
    // next update
    int operationalOverlapWeeks = 2;
    DateTime nextUpdateDateTime = listIssueDateTime.plusMonths(12 / 3).plusWeeks(operationalOverlapWeeks);
    trustServiceList.setNextUpdate(nextUpdateDateTime);

    trustServiceList.addOtherTSLPointer(
            "https://ec.europa.eu/information_society/policy/esignature/trusted-list/tl-hr.pdf",
            "application/pdf", "http://uri.etsi.org/TrstSvc/TrustedList/TSLType/EUlistofthelists", "EU",
            "European Commission", "http://uri.etsi.org/TrstSvc/TrustedList/schemerules/EUlistofthelists",
            Locale.ENGLISH, euSSLCertificate);

    TrustServiceList euTSL;
    try {
        euTSL = TrustServiceListFactory.newInstance(euTSLDocument);
    } catch (IOException e) {
        throw new RuntimeException("could not load EU trust list: " + e.getMessage(), e);
    }
    X509Certificate euCertificate = euTSL.verifySignature();
    LOG.debug("EU certificate: " + euCertificate);

    trustServiceList.addOtherTSLPointer(
            "https://ec.europa.eu/information_society/policy/esignature/trusted-list/tl-mp.xml",
            "application/vnd.etsi.tsl+xml", "http://uri.etsi.org/TrstSvc/TrustedList/TSLType/EUlistofthelists",
            "EU", "European Commission", "http://uri.etsi.org/TrstSvc/TrustedList/schemerules/EUlistofthelists",
            Locale.ENGLISH, euCertificate);

    /*
    Collections.sort(certipostTrustServiceProvider.getTrustServices(),new TrustServiceComparer());
    Collections.sort(trustServiceList.getTrustServiceProviders(), new TrustServiceProviderComparer());
    */
    return trustServiceList;
}

From source file:com.google.jenkins.plugins.credentials.oauth.P12ServiceAccountConfigTestUtil.java

private static X509Certificate generateCertificate(KeyPair keyPair)
        throws OperatorCreationException, CertificateException {
    Calendar endCalendar = Calendar.getInstance();
    endCalendar.add(Calendar.YEAR, 10);
    X509v3CertificateBuilder x509v3CertificateBuilder = new X509v3CertificateBuilder(
            new X500Name("CN=localhost"), BigInteger.valueOf(1), Calendar.getInstance().getTime(),
            endCalendar.getTime(), new X500Name("CN=localhost"),
            SubjectPublicKeyInfo.getInstance(keyPair.getPublic().getEncoded()));
    ContentSigner contentSigner = new JcaContentSignerBuilder("SHA1withRSA").build(keyPair.getPrivate());
    X509CertificateHolder x509CertificateHolder = x509v3CertificateBuilder.build(contentSigner);
    return new JcaX509CertificateConverter().setProvider("BC").getCertificate(x509CertificateHolder);
}

From source file:at.tugraz.ist.akm.networkInterface.WifiIpAddress.java

@SuppressWarnings("deprecation")
private String readWifiIP4Address() {
    String ip4Address = "0.0.0.0";
    byte[] ipAddress = BigInteger.valueOf(mWifiManager.getConnectionInfo().getIpAddress()).toByteArray();
    try {/*from w ww . j  av  a2  s. c om*/
        InetAddress address = InetAddress.getByAddress(ipAddress);
        String concreteAddressString = address.getHostAddress().toUpperCase(Locale.getDefault());
        if (InetAddressUtils.isIPv4Address(concreteAddressString)) {
            ip4Address = Formatter.formatIpAddress(mWifiManager.getConnectionInfo().getIpAddress());
        }
    } catch (UnknownHostException e) {
        return ip4Address;
    }
    return ip4Address;
}

From source file:org.spring.cache.CachingWithGeodeIntegrationTest.java

@Test
public void cCacheMissesAgain() {
    assertThat(mathService.factorial(BigInteger.valueOf(3)), is(equalTo(BigInteger.valueOf(6))));
    assertThat(mathService.wasCacheMiss(), is(true));
    assertThat(mathService.factorial(BigInteger.valueOf(5)), is(equalTo(BigInteger.valueOf(120))));
    assertThat(mathService.wasCacheMiss(), is(true));
    assertThat(mathService.factorial(BigInteger.valueOf(6)), is(equalTo(BigInteger.valueOf(720))));
    assertThat(mathService.wasCacheMiss(), is(true));
    assertThat(mathService.factorial(BigInteger.valueOf(7)), is(equalTo(BigInteger.valueOf(5040))));
    assertThat(mathService.wasCacheMiss(), is(true));
    assertThat(mathService.factorial(BigInteger.valueOf(9)), is(equalTo(BigInteger.valueOf(362880))));
    assertThat(mathService.wasCacheMiss(), is(true));
}

From source file:com.feathercoin.wallet.feathercoin.ExchangeRatesProvider.java

public static ExchangeRate getExchangeRate(final Cursor cursor) {
    final String currencyCode = cursor
            .getString(cursor.getColumnIndexOrThrow(ExchangeRatesProvider.KEY_CURRENCY_CODE));
    final BigInteger rate = BigInteger
            .valueOf(cursor.getLong(cursor.getColumnIndexOrThrow(ExchangeRatesProvider.KEY_RATE)));
    final String source = cursor.getString(cursor.getColumnIndexOrThrow(ExchangeRatesProvider.KEY_SOURCE));

    return new ExchangeRate(currencyCode, rate, source);
}