List of usage examples for java.math BigInteger ONE
BigInteger ONE
To view the source code for java.math BigInteger ONE.
Click Source Link
From source file:com.redhat.lightblue.metadata.types.BigIntegerTypeTest.java
@Test public void testCastBigInteger() { assertTrue(bigIntegerType.cast(BigInteger.ONE) instanceof BigInteger); }
From source file:org.candlepin.util.CrlFileUtilTest.java
@Before public void init() throws Exception { Injector injector = Guice.createInjector(new TestingModules.MockJpaModule(), new TestingModules.ServletEnvironmentModule(), new TestingModules.StandardTest()); injector.injectMembers(this); this.cfu = new CrlFileUtil(this.pkiReader, this.pkiUtility, this.certSerialCurator); this.temp = File.createTempFile("cp_test_crl-", ".pem"); this.initialEntry = new HashSet<BigInteger>(); this.initialEntry.add(BigInteger.ONE); }
From source file:opennlp.tools.similarity.apps.solr.WordDocBuilderEndNotes.java
public String buildWordDoc(List<HitBase> content, String title) { String outputDocFinename = absPath + "written/" + title.replace(' ', '_').replace('\"', ' ').trim() + ".docx"; WordprocessingMLPackage wordMLPackage = null; List<String> imageURLs = getAllImageSearchResults(title); int count = 0; BigInteger refId = BigInteger.ONE; try {/*from www . j av a2s.c o m*/ wordMLPackage = WordprocessingMLPackage.createPackage(); CTEndnotes endnotes = null; try { EndnotesPart ep = new EndnotesPart(); endnotes = Context.getWmlObjectFactory().createCTEndnotes(); ep.setJaxbElement(endnotes); wordMLPackage.getMainDocumentPart().addTargetPart(ep); } catch (InvalidFormatException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } wordMLPackage.getMainDocumentPart().addStyledParagraphOfText("Title", title.toUpperCase()); for (HitBase para : content) { if (para.getFragments() == null || para.getFragments().size() < 1) // no found content in this hit continue; try { String processedParaTitle = processParagraphTitle(para.getTitle()); if (processedParaTitle != null && !processedParaTitle.endsWith("..") || StringUtils.isAlphanumeric(processedParaTitle)) { wordMLPackage.getMainDocumentPart().addStyledParagraphOfText("Subtitle", processedParaTitle); } String paraText = processParagraphText(para.getFragments().toString()); wordMLPackage.getMainDocumentPart().addParagraphOfText(paraText); CTFtnEdn endnote = Context.getWmlObjectFactory().createCTFtnEdn(); endnotes.getEndnote().add(endnote); endnote.setId(refId); refId.add(BigInteger.ONE); String url = para.getUrl(); String endnoteBody = "<w:p xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" ><w:pPr><w:pStyle w:val=\"EndnoteText\"/></w:pPr><w:r><w:rPr>" + "<w:rStyle w:val=\"EndnoteReference\"/></w:rPr><w:endnoteRef/></w:r><w:r><w:t xml:space=\"preserve\"> " + url + "</w:t></w:r></w:p>"; try { endnote.getEGBlockLevelElts().add(XmlUtils.unmarshalString(endnoteBody)); } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); } // Add the body text referencing it String docBody = "<w:p xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" ><w:r><w:t>"//+ paraText /*+ refId.toString()*/ + "</w:t></w:r><w:r><w:rPr><w:rStyle w:val=\"EndnoteReference\"/></w:rPr><w:endnoteReference w:id=\"" + refId.toString() + "\"/></w:r></w:p>"; try { wordMLPackage.getMainDocumentPart().addParagraph(docBody); } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { addImageByImageURLToPackage(count, wordMLPackage, imageURLs); } catch (Exception e) { // no need to report issues //e.printStackTrace(); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } count++; } // now add URLs wordMLPackage.getMainDocumentPart().addStyledParagraphOfText("Subtitle", "REFERENCES"); for (HitBase para : content) { if (para.getFragments() == null || para.getFragments().size() < 1) // no found content in this hit continue; try { wordMLPackage.getMainDocumentPart().addStyledParagraphOfText("Subtitle", para.getTitle()); String paraText = para.getUrl(); wordMLPackage.getMainDocumentPart().addParagraphOfText(paraText); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } try { wordMLPackage.save(new File(outputDocFinename)); System.out.println("Finished creating docx =" + outputDocFinename); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } try { String fileNameToDownload = "/var/www/wrt_latest/" + title.replace(' ', '_').replace('\"', ' ').trim() + ".docx"; wordMLPackage.save(new File(fileNameToDownload)); System.out.println("Wrote a doc for download :" + fileNameToDownload); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return outputDocFinename; }
From source file:org.globus.gsi.gssapi.test.GlobusGSSCredentialTest.java
@Override protected void setUp() throws Exception { manager = new GlobusGSSManagerImpl(); kpg = KeyPairGenerator.getInstance("RSA"); certificateGenerator = new X509V3CertificateGenerator(); certificateGenerator.setIssuerDN(SELF_SIGNED_DN); certificateGenerator.setSubjectDN(SELF_SIGNED_DN); certificateGenerator.setNotBefore(new Date()); certificateGenerator.setNotAfter(new Date(System.currentTimeMillis() + 1000 * 60)); certificateGenerator.setSerialNumber(BigInteger.ONE); certificateGenerator.setSignatureAlgorithm("SHA1WithRSA"); }
From source file:org.spring.cache.CachingWithGeodeIntegrationTest.java
@Test public void bCacheHits() { assertThat(mathService.factorial(BigInteger.valueOf(0)), is(equalTo(BigInteger.ONE))); assertThat(mathService.wasCacheMiss(), is(false)); assertThat(mathService.factorial(BigInteger.valueOf(1)), is(equalTo(BigInteger.ONE))); assertThat(mathService.wasCacheMiss(), is(false)); assertThat(mathService.factorial(BigInteger.valueOf(2)), is(equalTo(MathService.TWO))); assertThat(mathService.wasCacheMiss(), is(false)); assertThat(mathService.factorial(BigInteger.valueOf(4)), is(equalTo(BigInteger.valueOf(24)))); assertThat(mathService.wasCacheMiss(), is(false)); assertThat(mathService.factorial(BigInteger.valueOf(8)), is(equalTo(BigInteger.valueOf(40320)))); assertThat(mathService.wasCacheMiss(), is(false)); }
From source file:de.decoit.visa.net.IPNetwork.java
/** * Construct a new network object. The provided address must match the * address notation of the specified IP version. * * @param pNetworkAddress String notation of the network IP address, must be * valid for the provided IP version * @param pSubnetMaskLength Bit length of the subnet mask used for this * network/*from w w w . j a v a2 s .c om*/ * @param pVersion Version of the Internet Protocol which will be used for * this network */ public IPNetwork(String pNetworkAddress, int pSubnetMaskLength, IPVersion pVersion) { int deviceMaskLength = pVersion.getAddressBitCount() - pSubnetMaskLength; if (deviceMaskLength >= 0 && deviceMaskLength <= pVersion.getAddressBitCount()) { // Calculate maximum number of device addresses in this network maxIPAddressCount = BigInteger.valueOf(2).pow(deviceMaskLength); // Subtract network and broadcast addresses maxIPAddressCount.subtract(BigInteger.valueOf(2)); } else { throw new IllegalArgumentException("Invalid subnet mask length provided"); } addressesInUse = new HashMap<>(); version = pVersion; subnetMask = pSubnetMaskLength; networkAddress = new IPAddress(pNetworkAddress, version); nextAddressMask = incrAddressMask(networkAddress.toBigIntBitmask(), BigInteger.ONE); lastAddressMask = incrAddressMask(networkAddress.toBigIntBitmask(), maxIPAddressCount); }
From source file:com.github.jrrdev.mantisbtsync.core.jobs.issues.writers.BugNotesWriterTest.java
/** * Build the items to write.//from w w w . j a v a 2s . com * * @return items */ private List<BugBean> buildItems() { final Calendar cal = Calendar.getInstance(); final Timestamp date = new Timestamp(cal.getTimeInMillis()); final List<BugBean> items = new ArrayList<BugBean>(); final BugBean item1 = new BugBean(); final BugNoteBean note = new BugNoteBean(); note.setId(BigInteger.ONE); note.setBugId(BigInteger.ONE); note.setReporterId(BigInteger.ONE); note.setTextNote("note_1"); note.setDateSubmitted(date); note.setLastModified(date); item1.getNotes().add(note); items.add(item1); return items; }
From source file:com.stitchgalaxy.dao.ProductCategoriesDaoTests.java
@Transactional public Long createProduct() { Product product = new Product(); product.setName("test"); product.setPriceUsd(new BigDecimal(BigInteger.ONE)); product.setDate(LocalDate.now()); productRepository.store(product);/*from ww w . ja va 2 s.co m*/ return product.getId(); }
From source file:PalidromeArray.java
public PalidromeArray(BigInteger totalLength) { this.totalLength = totalLength; this.halfLength = totalLength.divide(TWO); if (MathUtil.isOdd(totalLength)) { isEven = false;//w w w. ja v a 2 s. c om halfLength = halfLength.add(BigInteger.ONE); } array = new ConcurrentHashMap<BigInteger, BigInteger>(); }
From source file:com.github.jrrdev.mantisbtsync.core.jobs.issues.writers.BugHistoryWriterTest.java
/** * Build the items to write.// w w w.ja va 2s.c om * * @return items */ private List<BugBean> buildItems() { final Calendar cal = Calendar.getInstance(); final Timestamp date = new Timestamp(cal.getTimeInMillis()); final List<BugBean> items = new ArrayList<BugBean>(); final BugBean item1 = new BugBean(); final BugHistoryBean hist = new BugHistoryBean(); hist.setBugId(BigInteger.ONE); hist.setUserId(BigInteger.ONE); hist.setOldValue("old"); hist.setNewValue("new"); hist.setHistoryType(BigInteger.TEN); hist.setDateModified(date); item1.getHistory().add(hist); items.add(item1); return items; }