List of usage examples for java.math BigInteger BigInteger
private BigInteger(long val)
From source file:me.brjannc.plugins.sushi.AuthorizedKeysDecoder.java
private BigInteger decodeBigInt() { int len = decodeInt(); byte[] bigIntBytes = new byte[len]; System.arraycopy(bytes, pos, bigIntBytes, 0, len); pos += len;/*from ww w . ja va 2s. c o m*/ return new BigInteger(bigIntBytes); }
From source file:me.yanaga.querydsl.args.core.single.SingleBigIntegerArgumentTest.java
@Test public void testAppendGoeTwoArguments() { SingleBigIntegerArgument argument = SingleBigIntegerArgument.of(new BigInteger("200")); BooleanBuilder builder = new BooleanBuilder(); argument.append(builder, NumberExpression::goe, QPerson.person.oneBigInteger, QPerson.person.anotherBigInteger); Person result = new JPAQuery(entityManager).from(QPerson.person).where(builder) .uniqueResult(QPerson.person); assertThat(result.getAnotherBigInteger()).isEqualTo(new BigInteger("321")); }
From source file:org.glytoucan.api.soap.GlycoSequenceEndpointTest.java
@Test public void testSendAndReceiveG97036DW() { GlycoSequenceDetailRequest request = new GlycoSequenceDetailRequest(); request.setAccessionNumber("G97036DW"); Object result = new WebServiceTemplate(marshaller).marshalSendAndReceive("http://localhost:" + port + "/ws", request);// w w w. j a v a2s .com assertNotNull(result); GlycoSequenceDetailResponse response = (GlycoSequenceDetailResponse) result; logger.debug(response); logger.debug(response.getDescription()); Assert.assertEquals(new BigInteger("0"), response.getResponseMessage().getErrorCode()); Assert.assertEquals("G97036DW", response.getAccessionNumber()); Assert.assertTrue(response.getDescription().contains("Error+in+GlycoCT+validation")); }
From source file:it.geosolutions.opensdi.persistence.service.impl.TraceServiceTest.java
/** * Test for {@link TraceService#cleanByRun(GeobatchRunInfo)} method *//* www . j av a 2 s . c o m*/ @Test public void testCleanRunInfo() { try { int traces = 10; TraceDto trace = null; String fileName = generateRandomString(); for (int i = 0; i < traces; i++) { trace = getTestTrace(fileName, 10); trace.setNr_rec_scartati(new BigInteger(i + "")); trace = traceService.saveTrace(trace); } GeobatchRunInfo runInfo = getTestRunInfo(trace); List<TraceDto> list = traceService.searchByRun(runInfo); assertNotNull(list); assertTrue(!list.isEmpty()); assertTrue(list.size() == traces); traceService.cleanByRun(runInfo); list = traceService.searchByRun(runInfo); assertTrue(list == null || list.isEmpty()); } catch (Exception e) { e.printStackTrace(); fail(); } }
From source file:org.jsonschema2pojo.integration.json.JsonTypesIT.java
@Test public void integerIsMappedToBigInteger() throws Exception { ClassLoader resultsClassLoader = schemaRule.generateAndCompile("/json/simpleTypes.json", "com.example", config("sourceType", "json", "useBigIntegers", true)); Class<?> generatedType = resultsClassLoader.loadClass("com.example.SimpleTypes"); Object deserialisedValue = OBJECT_MAPPER .readValue(this.getClass().getResourceAsStream("/json/simpleTypes.json"), generatedType); assertThat((BigInteger) generatedType.getMethod("getB").invoke(deserialisedValue), is(new BigInteger("123"))); }
From source file:com.stratio.cassandra.index.schema.ColumnMapperBigInteger.java
/** {@inheritDoc} */ @Override/*from w ww. ja v a 2 s. com*/ public String indexValue(String name, Object value) { // Check not null if (value == null) { return null; } // Parse big decimal String svalue = value.toString(); BigInteger bi; try { bi = new BigInteger(svalue); } catch (NumberFormatException e) { String message = String.format("Field %s requires a base 10 integer, but found \"%s\"", name, svalue); throw new IllegalArgumentException(message); } // Check size if (bi.abs().toString().length() > digits) { throw new IllegalArgumentException("Value has more than " + digits + " digits"); } // Map bi = bi.add(complement); String bis = encode(bi); return StringUtils.leftPad(bis, hexDigits + 1, '0'); }