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:com.github.jrrdev.mantisbtsync.core.jobs.projects.ProjectsTaskletsConfiguration.java

/**
 * Build the tasklet which retrieves all subprojects related to the main
 * project passed as job parameter.//from  w w  w .j a  va2s.c o m
 *
 * @param authManager
 *          The portal auth manager
 * @param clientStub
 *          Axis client stub
 * @param jdbcTemplate
 *          JDBC template
 * @param userName
 *          MantisBT username. If anonymous access is used, should be an empty string.
 * @param password
 *          MantisBT password. If anonymous access is used, should be an empty string.
 * @param projectId
 *          The id of the project
 * @return the tasklet
 */
@Bean
@StepScope
public ProjectsListTasklet mantisProjectsListTasklet(final PortalAuthManager authManager,
        final MantisConnectBindingStub clientStub, final JdbcTemplate jdbcTemplate,
        @Value("#{jobParameters['mantis.username']}") final String userName,
        @Value("#{jobParameters['mantis.password']}") final String password,
        @Value("#{jobParameters['mantis.project_id']}") final Long projectId) {

    final ProjectsListTasklet tasklet = new ProjectsListTasklet();
    tasklet.setAuthManager(authManager);
    tasklet.setClientStub(clientStub);
    tasklet.setUserName(userName);
    tasklet.setPassword(password);
    tasklet.setJdbcTemplate(jdbcTemplate);
    tasklet.setProjectId(BigInteger.valueOf(projectId));

    return tasklet;
}

From source file:com.hotelbeds.hotelapimodel.auto.util.AssignUtils.java

public static BigInteger getHourDifference(final ZoneOffset zoneOffset) {
    return zoneOffset != null
            ? BigInteger.valueOf(Long.valueOf(zoneOffset.get(ChronoField.OFFSET_SECONDS)) / HOUR_SECONDS)
            : null;/*from   w  w w  .  ja v  a2s.co  m*/
}

From source file:org.brekka.stillingar.example.FieldTypesDOMTest.java

private static Testing writeConfig() {
    Random r = new Random();
    ConfigurationDocument doc = ConfigurationDocument.Factory.newInstance();
    Configuration newConfiguration = doc.addNewConfiguration();
    FeatureFlagType featureFlag = newConfiguration.addNewFeatureFlag();
    featureFlag.setKey("turbo");
    featureFlag.setBooleanValue(true);//from   w w w . j  av a 2s .c  o m
    Testing testing = newConfiguration.addNewTesting();
    testing.setAnyURI("http://brekka.org/" + RandomStringUtils.randomAlphanumeric(10));
    testing.setBoolean(r.nextBoolean());
    testing.setByte((byte) r.nextInt());
    Calendar cal = Calendar.getInstance();
    testing.setDate(cal);
    testing.setDateTime(cal);
    testing.setDecimal(BigDecimal.valueOf(r.nextDouble()));
    testing.setDouble(r.nextDouble());
    testing.setFloat(r.nextFloat());
    testing.setInt(r.nextInt());
    testing.setInteger(BigInteger.valueOf(r.nextLong()));
    testing.setLanguage("en");
    testing.setLong(r.nextLong());
    testing.setShort((short) r.nextInt());
    testing.setString(RandomStringUtils.randomAlphanumeric(24));
    testing.setTime(cal);
    testing.setUUID(UUID.randomUUID().toString());
    testing.setPeriod(new GDuration("P5Y2M10DT15H"));
    byte[] binary = new byte[32];
    r.nextBytes(binary);
    testing.setBinary(binary);
    TestSupport.write(doc);
    return testing;
}

From source file:it.gualtierotesta.gdocx.GTbl.java

/**
 * Set table grid values//from  w ww .  j  av a  2  s .c  o m
 *
 * @param aValues long array of grid values
 * @return same GTbl instance
 */
@Nonnull
public GTbl grid(@Nonnull final long... aValues) {

    Validate.notNull(aValues, "Grid values array not valid");

    if (0 < aValues.length) {
        tblGrid = FACTORY.createTblGrid();
        for (final long value : aValues) {
            final TblGridCol gridCol = FACTORY.createTblGridCol();
            gridCol.setW(BigInteger.valueOf(value));
            tblGrid.getGridCol().add(gridCol);
        }
    }
    return this;
}

From source file:com.netflix.imfutility.ConversionHelperTest.java

@Test
public void editUnitsToMilliseconds() {
    assertEquals(4000L, ConversionHelper.editUnitToMilliSeconds(BigInteger.valueOf(100), new BigFraction(25)));
    assertEquals(500L, ConversionHelper.editUnitToMilliSeconds(BigInteger.valueOf(25), new BigFraction(50)));
    assertEquals(3336L,/*from  w w w . j  av  a 2  s  .  co m*/
            ConversionHelper.editUnitToMilliSeconds(BigInteger.valueOf(100), new BigFraction(30000, 1001)));
}

From source file:ac.elements.parser.SimpleDBConverter.java

/**
 * Encodes real integer value into a string by offsetting and zero-padding
 * number up to the specified number of digits. Use this encoding method if
 * the data range set includes both positive and negative values.
 * //  w w  w. j a  v  a 2  s  .  c  o  m
 * com.xerox.amazonws.sdb.DataUtils
 * 
 * @param number
 *            int to be encoded
 * @return string representation of the int
 */
private static String encodeInt(int number) {
    int maxNumDigits = BigInteger.valueOf(Integer.MAX_VALUE).subtract(BigInteger.valueOf(Integer.MIN_VALUE))
            .toString(RADIX).length();
    long offsetValue = Integer.MIN_VALUE;

    BigInteger offsetNumber = BigInteger.valueOf(number).subtract(BigInteger.valueOf(offsetValue));
    String longString = offsetNumber.toString(RADIX);
    int numZeroes = maxNumDigits - longString.length();
    StringBuffer strBuffer = new StringBuffer(numZeroes + longString.length());
    for (int i = 0; i < numZeroes; i++) {
        strBuffer.insert(i, '0');
    }
    strBuffer.append(longString);
    return strBuffer.toString();
}

From source file:edu.umn.msi.tropix.proteomics.conversion.impl.ConversionUtils.java

/**
 * Contract: Scan must contain at least one peak list with a specified precision or 32 or 64.
 * /*  w ww  .j  av a 2 s . c  om*/
 * @param scan
 * @return
 */
public static double[] extractDoubles(final Scan scan) {
    final List<Peaks> peaksList = scan.getPeaks();
    checkArgument(peaksList != null && peaksList.size() > 0, "Scan doesn't appear to contain peaks.");
    final Peaks peaks = peaksList.get(0);
    return extractDoubles(peaks.getValue(), peaks.getPrecision().equals(BigInteger.valueOf(64)));
}

From source file:energy.usef.dso.service.business.DsoPlanboardValidatorServiceTest.java

@Test
public void testInValidPower() throws BusinessValidationException, IOException {
    Prognosis prognosis = buildPrognosisMessage();
    prognosis.getPTU().get(0).setPower(BigInteger.valueOf(1000000000000L));
    try {/*from   w w w. j  a va 2s  .c o m*/
        service.validatePtus(prognosis.getPTU());
    } catch (BusinessValidationException e) {
        assertEquals(DsoBusinessError.POWER_VALUE_TOO_BIG, e.getBusinessError());
        return;
    }
    fail("expected exception");
}

From source file:net.ripe.ipresource.Asn.java

@Override
public final BigInteger getValue() {
    return BigInteger.valueOf(longValue());
}