Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Jan Burse Newsgroups: comp.lang.java.programmer Subject: Re: BitSet vs BigInteger (false Android doc) Date: Fri, 02 Sep 2011 22:49:20 +0200 Organization: albasani.net Lines: 74 Message-ID: References: <4e613b65$0$311$14726298@news.sunsite.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8bit X-Trace: news.albasani.net c58G5H6XhQl+csSPvFeh/X03ONZ/ONg3ZRAPGiU2o7FfD2t3Svq2iDXH0F7k5o7aUeju+sCDUQ/TvM+BUV6VtQ== NNTP-Posting-Date: Fri, 2 Sep 2011 20:49:29 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="YTKRRyjfboobw3ENro/3HHV/3fa1l+wrmkbDqFmureBb4j/VxM5YgHmFtQajzqEJmu73pKd0s0Xvt10mvAh9MkWDTAjMaWN2T19/VW2iePQIOTJDBvPlULKMfHzuEu2p"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.1) Gecko/20110830 Firefox/6.0.1 SeaMonkey/2.3.1 In-Reply-To: <4e613b65$0$311$14726298@news.sunsite.dk> Cancel-Lock: sha1:rMy9/2mJPkXbMIgoevKJ2vpLn44= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7544 Arne Vajhøj schrieb: > > Not necessarily. > > If the internal representation does not match > the external representations then some operations could > be expensive due to the conversion between representations > and/or complications for the operation itself. > > Arne In the present case the internal representation is basically the same for BitSet and BigInteger. The operations are also the same. Here is the code for the logical xor in BigInteger and BitSet: BigInteger: public BigInteger xor(BigInteger val) { int[] result = new int[Math.max(intLength(), val.intLength())]; for (int i=0; i