JavaTM 2
Platform
Std.  Ed.  v1. 4.0

java.math
Ŭ·¡½º BigInteger

java.lang.Object 
  |
  +--java.lang.Number 
        |
        +--java.math.BigInteger
¸ðµç ±¸Çö ÀÎÅÍÆäÀ̽º:
Comparable , Serializable

public class BigInteger
extends Number
implements Comparable

º¯°æÀÌ ºÒ°¡´ÉÇÑ, ÀÓÀÇ Á¤¹ÐµµÀÇ Á¤¼öÀÔ´Ï´Ù. ¸ðµç ¿¬»êÀº BigInteger °¡ (Java ÀÇ ¿ø½ÃÀû Á¤¼öÇü°ú °°Àº) 2 Ä¡ º¸¼ö Ç¥±â¹ýÀ¸·Î ³ªÅ¸³»Á³´ÂÁö¿Í °°ÀÌ µ¿ÀÛÇÕ´Ï´Ù. BigInteger ´Â Java ÀÇ ¸ðµç ¿ø½ÃÀû Á¤¼ö ¿¬»êÀÚ¿Í java.lang.Math ÀÇ °ü·ÃÇÏ´Â ¸ðµç ¸Þ¼Òµå¿¡ µ¿µîÀÇ °ÍÀ» Á¦°øÇÕ´Ï´Ù. ¶Ç, BigInteger ´Â ¸ðµâ·¯ »ê¼ú, GCD °è»ê, ¼Ò¼öµµ Å×½ºÆ®, ¼Ò¼ö »ý¼º, ºñÆ® Á¶ÀÛ, ±× ¿ÜÀÇ ¸î°³ÀÇ Á¶ÀÛ¿¡ ´ëÇÑ ¿¬»êµµ Á¦°øÇÕ´Ï´Ù.

»ê¼ú ¿¬»êÀÇ ½Ã¸àƽ½º´Â ¡¸Java ¾ð¾î »ç¾ç¡¹¿¡ Á¤Àǵǰí ÀÖ°Ô Java ÀÇ Á¤¼ö »ê¼ú ¿¬»êÀÚ¸¦ Á¤È®ÇÏ°Ô ¸ð¹æÇÕ´Ï´Ù. ¿¹¸¦ µé¾î, Á¦·Î Á¦»êÀº ArithmeticException ¸¦ ½½·Î¿ì ÇØ, Á¤ÀÇ ¼ö¿¡ ÀÇÇÑ ºÎÀÇ ¼öÀÇ Á¦»êÀº ºÎ (¶Ç´Â 0)ÀÇ À׿©¸¦ ³À´Ï´Ù. ¿À¹öÇ÷ο쿡 °üÇÑ »ç¾ç³»ÀÇ ÀÚ¼¼ÇÑ °ÍÀº ¸ðµÎ ¹«½ÃµÇ¾î BigInteger ´Â ¿¬»êÀÇ °á°úÀÇ ¼ö¶ô¿¡ ÇÊ¿äÇÑ ¸¸Å­ Ä¿Áý´Ï´Ù.

½¬ÇÁÆ® ¿¬»êÀÇ ½Ã¸àƽ½º´Â ºÎÀÇ ½¬ÇÁÆ® À̵¿·®À» °í·ÁÇϱâ À§ÇØ(¶§¹®¿¡) Java ÀÇ ½¬ÇÁÆ® ¿¬»êÀÚ¸¦ È®ÀåÇϰí ÀÖ½À´Ï´Ù. ºÎÀÇ ½¬ÇÁÆ® À̵¿·®À» °¡Áö´Â ¿À¸¥ÂÊ ½¬ÇÁÆ®´Â ¿ÞÂÊ ½¬ÇÁÆ®°¡ µË´Ï´Ù. ¿ªÀÇ °æ¿ìµµ °°½À´Ï´Ù. ºÎÈ£ ¾øÀ½ÀÇ ¿À¸¥ÂÊ ½¬ÇÁÆ® ¿¬»êÀÚ (>>>)´Â ÀÌ ¿¬»ê¿¡¼­´Â ÀÌ Å¬·¡½º°¡ Á¦°øÇÏ´Â ¡¸¹«ÇÑÀÇ ¿öµå »çÀÌÁÃßÃâ°ú Á¶ÇÕÇÏ´Â Àǹ̰¡ °ÅÀÇ ¾ø±â ¶§¹®¿¡ »ý·«ÇØÁö°í ÀÖ½À´Ï´Ù.

ºñÆ® ´ÜÀ§ÀÇ ³í¸® ¿¬»êÀÇ ½Ã¸àƽ½º´Â Java ÀÇ ºñÆ® Á¤¼ö ¿¬»êÀÚÀÇ ½Ã¸àƽ½º¸¦ Á¤È®ÇÏ°Ô ¸ð¹æÇϰí ÀÖ½À´Ï´Ù. 2 Ç׿¬»êÀÚ (and,or,xor)´Â ¿¬»êÀü¿¡ 2 °³ÀÇ ¿ÀÆÛ·£µåÀÇ ÂªÀº (ºÐ)Æí¿¡ ´ëÇØ¼­ ¾Ï¹¬¿¡ ºÎÈ£ È®ÀåÀ» ½Ç½ÃÇÕ´Ï´Ù.

ºñ±³ ¿¬»êÀº ºÎÈ£ ÷ºÎ Á¤¼öÀÇ ºñ±³¸¦ ½Ç½ÃÇÕ´Ï´Ù. À̰ÍÀº Java ÀÇ °ü·ÃÇÏ´Â ¿¬»êÀÚ ¹× µ¿µîÀÇ ¿¬»êÀÚ¿¡ ÀÇÇØ ÇàÇØÁö´Â °Í °Í°ú °°½À´Ï´Ù.

¸ðµâ·¯ »ê¼ú ¿¬»êÀº À׿© °è»ê, ³ª¹«½Â, ¹× °ö¼À ¿ª¼ö °è»êÀ» À§Çؼ­(¶§¹®¿¡) Á¦°øµÇ°í ÀÖ½À´Ï´Ù. ÀÌ·¯ÇÑ ¸Þ¼Òµå´Â Ç×»ó 0 À¸·Î (¸ðÁê¶ó½º - 1) ÀÇ »çÀÌÀÇ ºÎ°¡ ¾Æ´Ñ °á°ú¸¦ µ¹·ÁÁÝ´Ï´Ù (¸ðÁê¶ó½º - 1 À» Æ÷ÇÔÇÑ´Ù).

ºñÆ® ¿¬»êÀº ¿ÀÆÛ·£µåÀÇ 2 ÀÇ º¸¼ö Ç¥ÇöÀÇ ½Ì±Û ºñÆ®¿¡ »ç¿ëÇÕ´Ï´Ù. Çʿ信 µû¶ó¼­, ¿ÀÆÛ·£µåÀÇ ºÎÈ£´Â Áö½ÃÇÏ´Â ºñÆ®¸¦ °¡Áöµµ·Ï(µíÀÌ) È®ÀåµË´Ï´Ù. ¿¬»êÁßÀÇ BigInteger ¿Í ´Ù¸¥ ºÎÈ£¸¦ °¡Áö´Â BigInteger ¸¦ »ý¼ºÇÏ´Â ½Ì±Û ºñÆ® ¿¬»êÀº ¾ø½À´Ï´Ù. À̰ÍÀº ½Ì±Û ºñÆ® ¿¬»êÀÌ ´ÜÀÏÀÇ ºñÆ®¿¡°Ô¸¸ ¿µÇâÀ» ÁÖ¾î, ÀÌ Å¬·¡½º°¡ Á¦°øÇÏ´Â ¡¸¹«ÇÑÀÇ ¿öµå »çÀÌÁÃßÃâ¿¡ ÀÇÇØ, °¢ BigInteger ¿¡ ¼±ÇàÇÏ´Â ¹«ÇÑÀÇ ¡¸°¡»ó ºÎÈ£ ºñÆ®¡¹°¡ Á¸ÀçÇϱâ (À§ÇØ)¶§¹®¿¡ÀÔ´Ï´Ù.

¼³¸íÀ» ¾Ë±â ½±°í °£°áÇÏ°Ô Çϱâ À§Çؼ­, BigInteger ¸Þ¼ÒµåÀÇ ¼³¸í¿¡¼­´Â Àüü¸¦ ÅëÇØ ÀÇ»ç Äڵ带 »ç¿ëÇÕ´Ï´Ù. ÀÇ»ç ÄÚµå½Ä (i + j) Àº °ªÀÌ BigInteger i ÀÇ °ª°ú BigInteger j ÀÇ °ªÀÇ È­ÀÎ BigInteger ¸¦ ³ªÅ¸³À´Ï´Ù. ÀÇ»ç ÄÚµå½Ä (i == j) Àº BigInteger i °¡ BigInteger j ¿Í °°Àº °ªÀ» ³ªÅ¸³»´Â °æ¿ì¿¡¸¸ true ÀÎ °ÍÀ» ³ªÅ¸³»°í ÀÖ½À´Ï´Ù. ´Ù¸¥ ÀÇ»ç ÄÚµå½Äµµ ¶È°°ÀÌ ÇØ¼®µË´Ï´Ù.

ÀÌ Å¬·¡½ºÀÇ ¸Þ¼Òµå ¹× constructor Àº ¸ðµÎ, ÀÔ·Â ÆÄ¶ó¸ÞÀÌŸ¿¡ ´ëÇØ¼­ null ¿ÀºêÁ§Æ® ÂüÁ¶°¡ °Ç³×¹ÞÀ¸¸é(ÀÚ) NullPointerException ¸¦ ½½·Î¿ì ÇÕ´Ï´Ù.

µµÀÔµÈ ¹öÁ¯:
JDK1. 1
°ü·Ã Ç׸ñ:
BigDecimal , Á÷·ÄÈ­ µÈ Çü½Ä

ÇʵåÀÇ °³¿ä
static BigInteger ONE
          BigInteger Á¤¼ö 1 ÀÔ´Ï´Ù.
static BigInteger ZERO
          BigInteger Á¤¼ö 0 ÀÔ´Ï´Ù.
 
»ý¼ºÀÚÀÇ °³¿ä
BigInteger (byte[] val)
          BigInteger ÀÇ 2 ÀÇ º¸¼ö 2 ÁøÇ¥ÇöÀ» Æ÷ÇÔÇÑ ¹ÙÀÌÆ® ¹è¿­À» BigInteger ·Î º¯È¯ÇÕ´Ï´Ù.
BigInteger (int signum, byte[] magnitude)
          BigInteger ÀÇ ºÎÈ£ Àý´ëÄ¡ Ç¥ÇöÀ» BigInteger ·Î º¯È¯ÇÕ´Ï´Ù.
BigInteger (int bitLength, int certainty, Random  rnd)
          ·£´ý¿¡ »ý¼ºµÈ (¾Æ¸¶ ¼Ò¼öÀÌ´Ù) Á¤ÀÇ BigInteger ¸¦, ÁöÁ¤ÇÑ ºñÆ®¼ö·Î ±¸ÃàÇÕ´Ï´Ù.
BigInteger (int numBits, Random  rnd)
          0 ~ (2numBits - 1) ÀÇ ¹üÀ§¿¡ ÇѰᰰ°Ô ºÐ»êµÇ°í ÀÖ´Â ·£´ý¿¡ »ý¼ºµÈ BigInteger ¸¦ ±¸ÃàÇÕ´Ï´Ù.
BigInteger (String  val)
          BigInteger ÀÇ 10 Áø String Ç¥ÇöÀ» BigInteger ·Î º¯È¯ÇÕ´Ï´Ù.
BigInteger (String  val, int radix)
          ÁöÁ¤µÈ ±â¼ö³»ÀÇ BigInteger ÀÇ String Ç¥ÇöÀ» BigInteger ·Î º¯È¯ÇÕ´Ï´Ù.
 
¸Þ¼ÒµåÀÇ °³¿ä
 BigInteger abs ()
          °ªÀÌ ÀÌ BigInteger ÀÇ Àý´ëÄ¡ÀÎ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù.
 BigInteger add (BigInteger  val)
          °ªÀÌ (this + val) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù.
 BigInteger and (BigInteger  val)
          °ªÀÌ (this & val) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù (ÀÌ ¸Þ¼Òµå´Â this ¿Í val ÀÇ ¾çÂÊ ¸ðµÎ°¡ ºÎÀÇ °æ¿ì´Â ºÎÀÇ BigInteger ¸¦ µ¹·ÁÁØ´Ù).
 BigInteger andNot (BigInteger  val)
          °ªÀÌ (this & ~val) ÀÎ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù.
 int bitCount ()
          ÀÌ BigInteger ÀÇ 2 ÀÇ º¸¼ö Ç¥Çö³»ÀÇ, ºÎÈ£ ºñÆ®¿Í ´Ù¸¥ ºñÆ®ÀÇ ¼ö¸¦ µ¹·ÁÁÝ´Ï´Ù.
 int bitLength ()
          ÀÌ BigInteger ÀÇ ÃÖ¼ÒÀÇ 2 ÀÇ º¸¼ö Ç¥Çö³»ÀÇ ºñÆ®¼ö¸¦ µ¹·ÁÁÝ´Ï´Ù.
 BigInteger clearBit (int n)
          °ªÀÌ ÀÌ BigInteger ¿¡ µ¿ÀÏÇÑ BigInteger ¸¦, ÁöÁ¤µÈ ºñÆ®¸¦ Ŭ¸®¾î ÇØ µ¹·ÁÁÝ´Ï´Ù ((this & ~(1<<n)) ¸¦ °è»êÇÑ´Ù).
 int compareTo (BigInteger  val)
          ÀÌ BigInteger °¡ ÁöÁ¤µÈ BigInteger ¿Í ºñ±³ÇÕ´Ï´Ù.
 int compareTo (Object  o)
          ÀÌ BigInteger ¸¦ ÁöÁ¤ÇÑ Object ¿Í ºñ±³ÇÕ´Ï´Ù.
 BigInteger divide (BigInteger  val)
          °ªÀÌ (this / val) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù.
 BigInteger [] divideAndRemainder (BigInteger  val)
          (this / val) ±×¸®°í (this % val) °è¼ÓµÇ´Â 2 °³ÀÇ BigInteger ÀÇ ¹è¿­À» µ¹·ÁÁÝ´Ï´Ù.
 double doubleValue ()
          ÀÌ BigInteger ¸¦ double ·Î º¯È¯ÇÕ´Ï´Ù.
 boolean equals (Object  x)
          ÀÌ BigInteger ¿Í ÁöÁ¤µÈ Object °¡ µ¿ÀÏÇÑÁö ¾î¶²Áö¸¦ ºñ±³ÇÕ´Ï´Ù.
 BigInteger flipBit (int n)
          °ªÀÌ ÀÌ BigInteger ¿¡ µ¿ÀÏÇÑ BigInteger ¸¦, ÁöÁ¤µÈ ºñÆ®¸¦ ¹ÝÀü½ÃÄÑ µ¹·ÁÁÝ´Ï´Ù ((this ^ (1<<n)) ¸¦ °è»êÇÑ´Ù).
 float floatValue ()
          ÀÌ BigInteger ¸¦ float ·Î º¯È¯ÇÕ´Ï´Ù.
 BigInteger gcd (BigInteger  val)
          °ªÀÌ abs(this) ¿Í abs(val) ÀÇ ÃÖ´ë°ø¾à¼öÀÎ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù.
 int getLowestSetBit ()
          ÀÌ BigInteger ÀÇ °¡Àå ¿ìÃø (1 ¹ø ³·Àº À§)ÀÇ 1 ºñÆ®ÀÇ À妽º (°¡Àå ¿ìÃøÀÇ 1 ºñÆ®ÀÇ ¿ìÃøÇâÀÇ 0 ºñÆ®ÀÇ ¼ö)¸¦ µ¹·ÁÁÝ´Ï´Ù.
 int hashCode ()
          ÀÌ BigInteger ÀÇ ÇØ½Ã Äڵ带 µ¹·ÁÁÝ´Ï´Ù.
 int intValue ()
          ÀÌ BigInteger ¸¦ int ·Î º¯È¯ÇÕ´Ï´Ù.
 boolean isProbablePrime (int certainty)
          ÀÌ BigInteger °¡ ¼Ò¼öÀÏ °¡´É¼ºÀÌ ³ôÀº °æ¿ì´Â true ¸¦ µ¹·ÁÁÖ¾î, ¹Ýµå½Ã ÇÕ¼º¼öÀÎ °æ¿ì´Â false ¸¦ µ¹·ÁÁÝ´Ï´Ù.
 long longValue ()
          ÀÌ BigInteger ¸¦ long ·Î º¯È¯ÇÕ´Ï´Ù.
 BigInteger max (BigInteger  val)
          ÀÌ BigInteger ¿Í val ÀÇ ÃÖ´ëÄ¡¸¦ µ¹·ÁÁÝ´Ï´Ù.
 BigInteger min (BigInteger  val)
          ÀÌ BigInteger ¿Í val ÀÇ ÃÖ¼ÒÄ¡¸¦ µ¹·ÁÁÝ´Ï´Ù.
 BigInteger mod (BigInteger  m)
          °ªÀÌ (this mod m)ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù.
 BigInteger modInverse (BigInteger  m)
          °ªÀÌ (this-1 mod m) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù.
 BigInteger modPow (BigInteger  exponent, BigInteger  m)
          °ªÀÌ (thisexponent mod m) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù (pow ¿Í ´Þ¸®, ÀÌ ¸Þ¼Òµå´Â ºÎÀÇ Áö¼ö¸¦ Çã¿ë ÇÑ´Ù).
 BigInteger multiply (BigInteger  val)
          °ªÀÌ (this * val) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù.
 BigInteger negate ()
          °ªÀÌ (-this) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù.
 BigInteger not ()
          °ªÀÌ (~this) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù (ÀÌ ¸Þ¼Òµå´Â ÀÌ BigInteger °¡ ºÎ°¡ ¾Æ´Ñ °æ¿ì¿¡ ºÎÀÇ °ªÀ» µ¹·ÁÁØ´Ù).
 BigInteger or (BigInteger  val)
          °ªÀÌ (this | val) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù (ÀÌ ¸Þ¼Òµå´Â this ¶Ç´Â val °¡ ºÎÀÇ °æ¿ì´Â ºÎÀÇ BigInteger ¸¦ µ¹·ÁÁØ´Ù).
 BigInteger pow (int exponent)
          °ªÀÌ (thisexponent) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù.
static BigInteger probablePrime (int bitLength, Random  rnd)
          ÁöÁ¤µÈ bit length·Î Á¤ÀÇ BigInteger (¾Æ¸¶ ¼Ò¼ö)¸¦ µ¹·ÁÁÝ´Ï´Ù.
 BigInteger remainder (BigInteger  val)
          °ªÀÌ (this % val) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù.
 BigInteger setBit (int n)
          °ªÀÌ ÀÌ BigInteger ¿¡ µ¿ÀÏÇÑ BigInteger ¸¦, ÁöÁ¤µÈ ºñÆ®¸¦ ¼³Á¤ÇØ µ¹·ÁÁÝ´Ï´Ù ((this | (1<<n)) ¸¦ °è»êÇÑ´Ù).
 BigInteger shiftLeft (int n)
          °ªÀÌ (this << n) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù.
 BigInteger shiftRight (int n)
          °ªÀÌ (this >> n) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù.
 int signum ()
          ÀÌ BigInteger ÀÇ ºÎÈ£ ¿ä¼Ò¸¦ µ¹·ÁÁÝ´Ï´Ù.
 BigInteger subtract (BigInteger  val)
          °ªÀÌ (this - val) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù.
 boolean testBit (int n)
          ÁöÁ¤µÈ ºñÆ®°¡ ¼³Á¤µÇ¾î ÀÖ´Â °æ¿ì¿¡¸¸ true ¸¦ µ¹·ÁÁÝ´Ï´Ù ((this & (1<<n)) !
 byte[] toByteArray ()
          ÀÌ BigInteger ÀÇ 2 ÀÇ º¸¼ö Ç¥ÇöÀ» Æ÷ÇÔÇÑ ¹ÙÀÌÆ® ¹è¿­À» µ¹·ÁÁÝ´Ï´Ù.
 String toString ()
          ÀÌ BigInteger ÀÇ 10 Áø String Ç¥ÇöÀ» µ¹·ÁÁÝ´Ï´Ù.
 String toString (int radix)
          ÁöÁ¤µÈ ±â¼ö³»ÀÇ ÀÌ BigInteger ÀÇ String Ç¥ÇöÀ» µ¹·ÁÁÝ´Ï´Ù.
static BigInteger valueOf (long val)
          °ªÀÌ ÁöÁ¤ÇÑ long ÀÇ °ª°ú µ¿ÀÏÇÑ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù.
 BigInteger xor (BigInteger  val)
          °ªÀÌ (this ^ val) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù (ÀÌ ¸Þ¼Òµå´Â this ¿Í val ÀÇ ´Ù¸¥ ÇÑÂʸ¸ÀÌ ºÎÀÇ °æ¿ì¿¡ ºÎÀÇ BigInteger ¸¦ µ¹·ÁÁØ´Ù).
 
Ŭ·¡½º java.lang. Number ¿¡¼­ »ó¼Ó¹ÞÀº ¸Þ¼Òµå
byteValue , shortValue
 
Ŭ·¡½º java.lang. Object ¿¡¼­ »ó¼Ó¹ÞÀº ¸Þ¼Òµå
clone , finalize , getClass , notify , notifyAll , wait , wait , wait
 

ÇʵåÀÇ »ó¼¼

ZERO

public static final BigInteger  ZERO
BigInteger Á¤¼ö 0 ÀÔ´Ï´Ù.

µµÀÔµÈ ¹öÁ¯:
1.2

ONE

public static final BigInteger  ONE
BigInteger Á¤¼ö 1 ÀÔ´Ï´Ù.

µµÀÔµÈ ¹öÁ¯:
1.2
»ý¼ºÀÚÀÇ »ó¼¼

BigInteger

public BigInteger(byte[] val)
BigInteger ÀÇ 2 ÀÇ º¸¼ö 2 ÁøÇ¥ÇöÀ» Æ÷ÇÔÇÑ ¹ÙÀÌÆ® ¹è¿­À» BigInteger ·Î º¯È¯ÇÕ´Ï´Ù. ÀÔ·Â ¹è¿­Àº ¡¸ºò endian¡¹ÀÇ ¹ÙÀÌÆ® ¼ø¼­ (ÃÖ»óÁ¤µµ ¹ÙÀÌÆ®°¡ [0] ¹øÂ°ÀÇ ¿ä¼Ò)¶ó°í º¸¿©Áý´Ï´Ù.

ÆÄ¶ó¹ÌÅÍ:
val - BigInteger ÀÇ, ºò endian 2 ÀÇ º¸¼ö ¹ÙÀ̳ʸ® Ç¥Çö
¿¹¿Ü:
NumberFormatException - val ÀÇ ±æÀ̰¡ 0 ¹ÙÀÌÆ®ÀÇ °æ¿ì

BigInteger

public BigInteger(int signum,
                  byte[] magnitude)
BigInteger ÀÇ ºÎÈ£ Àý´ëÄ¡ Ç¥ÇöÀ» BigInteger ·Î º¯È¯ÇÕ´Ï´Ù. ºÎÈ£´Â Á¤¼öÀÇ ºÎȣġ (ºÎ´Â -1, Á¦·Î´Â 0, Á¤Àº 1)·Î¼­ ³ªÅ¸³»Áý´Ï´Ù. Àý´ëÄ¡´Â ¡¸ºò endian¡¹ÀÇ ¹ÙÀÌÆ® ¼ø¼­ÀÇ ¹ÙÀÌÆ® ¹è¿­ (ÃÖ»óÁ¤µµ ¹ÙÀÌÆ®°¡ [0] ¹øÂ°ÀÇ ¿ä¼Ò)ÀÔ´Ï´Ù. ±æÀ̰¡ 0 ÀÇ Àý´ëÄ¡ ¹è¿­Àº Çã¿ë µÇ¾î signum °¡ -1, 0, ¶Ç´Â 1 ÀÇ ¾î¶² °ÍÀÏ±î ¿¡ °ü°è¾øÀÌ BigInteger Ä¡ 0 ÀÌ µË´Ï´Ù.

ÆÄ¶ó¹ÌÅÍ:
signum - ¼ýÀÚÀÇ ºÎÈ£ (ºÎ´Â -1, Á¦·Î´Â 0, Á¤Àº 1)
magnitude - ¼ýÀÚÀÇ Àý´ëÄ¡ÀÇ ºò endian ¹ÙÀ̳ʸ® Ç¥Çö
¿¹¿Ü:
NumberFormatException - signum °¡ 3 °³ÀÇ À¯È¿ÇÑ °ª (-1, 0, 1)ÀÇ ¾î¶² °Íµµ ¾Æ´ÑÁö signum °¡ 0 À¸·Î,magnitude ¿¡ 1 °³ ÀÌ»óÀÇ 0 ÀÌ¿ÜÀÇ ¹ÙÀÌÆ®°¡ Æ÷ÇԵǾî ÀÖ´Â °æ¿ì

BigInteger

public BigInteger(String  val,
                  int radix)
ÁöÁ¤µÈ ±â¼ö³»ÀÇ BigInteger ÀÇ String Ç¥ÇöÀ» BigInteger ·Î º¯È¯ÇÕ´Ï´Ù. String Ç¥ÇöÀº ÁöÁ¤µÈ ±â¼ö³»ÀÇ ÀÓÀÇÀÇ ¸¶À̳ʽº ºÎÈ£¿Í °Å±â¿¡ °è¼ÓµÇ´Â 1 kr ÀÌ»óÀÇ ¼ýÀÚÀÇ ¿­·Î ±¸¼ºµË´Ï´Ù. ij¸¯ÅÍÇüÀ¸·ÎºÎÅÍ ¼öÄ¡Çü¿¡ÀÇ ¸ÅÇÎÀº Character.digit ·Î Á¦°øµÇ°í ÀÖ½À´Ï´Ù. String ¿¡´Â ºÎÀûÀýÇÑ Ä³¸¯ÅÍ (°ø¹éµî)¸¦ Æ÷ÇÔÇÒ ¼ö ¾ø½À´Ï´Ù.

ÆÄ¶ó¹ÌÅÍ:
val - BigInteger ÀÇ String Ç¥Çö
radix - val ÀÇ ÇØ¼®À¸·Î »ç¿ëµÇ´Â ±â¼ö
¿¹¿Ü:
NumberFormatException - val °¡ ÁöÁ¤ÇÑ ±â¼ö³»ÀÇ BigInteger ÀÇ À¯È¿ÇÑ Ç¥ÇöÀÌ ¾Æ´ÑÁö radix °¡ Character.MIN_RADIX (2) ~ Character.MAX_RADIX (36)ÀÇ ¹üÀ§¿Ü¿¡ ÀÖ´Â °æ¿ì
°ü·Ã Ç׸ñ:
Character.digit(char, int)

BigInteger

public BigInteger(String  val)
BigInteger ÀÇ 10 Áø String Ç¥ÇöÀ» BigInteger ·Î º¯È¯ÇÕ´Ï´Ù. String Ç¥ÇöÀº ÀÓÀÇÀÇ ¸¶À̳ʽº ºÎÈ£¿Í °Å±â¿¡ °è¼ÓµÇ´Â 1 kr ÀÌ»óÀÇ 10 Áø¼öÀÚÀÇ ¿­·Î ±¸¼ºµË´Ï´Ù. ij¸¯ÅÍÇüÀ¸·ÎºÎÅÍ ¼öÄ¡Çü¿¡ÀÇ ¸ÅÇÎÀº Character.digit ·Î Á¦°øµÇ°í ÀÖ½À´Ï´Ù. String ¿¡´Â ºÎÀûÀýÇÑ Ä³¸¯ÅÍ (°ø¹éµî)¸¦ Æ÷ÇÔÇÒ ¼ö ¾ø½À´Ï´Ù.

ÆÄ¶ó¹ÌÅÍ:
val - BigInteger ÀÇ 10 Áø¼öÀÇ String Ç¥Çö
¿¹¿Ü:
NumberFormatException - val ´Â BigInteger ÀÇ Ç¥ÇöÀ¸·Î¼­´Â ¹«È¿ÀÎ
°ü·Ã Ç׸ñ:
Character.digit(char, int)

BigInteger

public BigInteger(int numBits,
                  Random  rnd)
0 ~ (2numBits - 1) ÀÇ ¹üÀ§¿¡ ÇѰᰰ°Ô ºÐ»êµÇ°í ÀÖ´Â ·£´ý¿¡ »ý¼ºµÈ BigInteger ¸¦ ±¸ÃàÇÕ´Ï´Ù. ºÐ»êÀÇ ÇѰᰰÀ½Àº rnd ÀÇ ·£´ý ºñÆ®ÀÇ ¼Ò½º¿¡ À߸øÀÌ ¾ø´Â °ÍÀ» ÀüÁ¦·Î ÇÕ´Ï´Ù. ÀÌ constructor Àº Ç×»ó ºÎ°¡ ¾Æ´Ñ BigInteger ¸¦ ±¸ÃàÇÕ´Ï´Ù.

ÆÄ¶ó¹ÌÅÍ:
numBits - »õ·Î¿î BigInteger ÀÇ ÃÖ´ë ºñÆ®¼ö
rnd - »õ·Î¿î BigInteger ÀÇ °è»êÀ¸·Î »ç¿ëµÇ´Â ·£´ý ºñÆ®ÀÇ ¼Ò½º
¿¹¿Ü:
IllegalArgumentException - numBits °¡ ºÎÀÇ °æ¿ì
°ü·Ã Ç׸ñ:
bitLength()

BigInteger

public BigInteger(int bitLength,
                  int certainty,
                  Random  rnd)
·£´ý¿¡ »ý¼ºµÈ (¾Æ¸¶ ¼Ò¼öÀÌ´Ù) Á¤ÀÇ BigInteger ¸¦, ÁöÁ¤ÇÑ ºñÆ®¼ö·Î ±¸ÃàÇÕ´Ï´Ù.

È®·üÀ» ÁöÁ¤ÇÒ Çʿ䰡 ¾ø´Â °æ¿ì´Â ÀÌ constructor Àº ¾Æ´Ï°í probablePrime ¸Þ¼Òµå¸¦ »ç¿ëÇÏ´Â °ÍÀ» ÃßõÇÕ´Ï´Ù.

ÆÄ¶ó¹ÌÅÍ:
bitLength - µ¹·ÁÁÖ¾îÁö´Â BigInteger ÀÇ bit length
certainty - È£ÃâÃøÀÌ Çã¿ë ÇÏÁö ¾Ê´Â È®·üÀÇ Ã´µµ. »õ·Î¿î BigInteger °¡ ¼Ò¼öÀÎ È®·üÀº (1 - 1/2certainty)º¸´Ù Å©´Ù. ÀÌ instructorÀÇ ½ÇÇà ½Ã°£Àº ÀÌ ÆÄ¶ó¹ÌÅÍÀÇ °ª ¿¡ ºñ·ÊÇÏ´Â
rnd - ¼Ò¼öµµ¸¦ Å×½ºÆ®ÇÏ´Â Èĺ¸ÀÇ ¼±ÅÃÀ¸·Î »ç¿ëµÇ´Â ·£´ý ºñÆ®ÀÇ ¼Ò½º
¿¹¿Ü:
ArithmeticException - bitLength < 2
°ü·Ã Ç׸ñ:
bitLength()
¸Þ¼ÒµåÀÇ »ó¼¼

probablePrime

public static BigInteger  probablePrime(int bitLength,
                                       Random  rnd)
ÁöÁ¤µÈ bit length·Î Á¤ÀÇ BigInteger (¾Æ¸¶ ¼Ò¼ö)¸¦ µ¹·ÁÁÝ´Ï´Ù. ÀÌ ¸Þ¼Òµå·ÎºÎÅÍ µ¹·ÁÁÖ¾îÁö´Â BigInteger °¡ ÇÕ¼º¼öÀÎ È®·üÀº 2-100 ¸¦ ³ÑÁö ¾Ê½À´Ï´Ù.

ÆÄ¶ó¹ÌÅÍ:
bitLength - µ¹·ÁÁÖ¾îÁö´Â BigInteger ÀÇ bit length
rnd - ¼Ò¼öµµ¸¦ Å×½ºÆ®ÇÏ´Â Èĺ¸ÀÇ ¼±ÅÃÀ¸·Î »ç¿ëµÇ´Â ·£´ý ºñÆ®ÀÇ ¼Ò½º
¹Ýȯ°ª:
bitLengthÀÇ BigInteger. ¾Æ¸¶ ¼Ò¼ö
¿¹¿Ü:
ArithmeticException - bitLength < 2
°ü·Ã Ç׸ñ:
bitLength()

valueOf

public static BigInteger  valueOf(long val)
°ªÀÌ ÁöÁ¤ÇÑ long ÀÇ °ª°ú µ¿ÀÏÇÑ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù. ÀÌ static ¸Þ¼Òµå´Â ÀÚÁÖ(Àß) »ç¿ëµÇ´Â BigInteger ¸¦ ÀçÀÌ¿ëÇÒ ¼ö ÀÖ°Ô Çϱâ À§Çؼ­, long ¸¦ Àμö·Î ÇÏ´Â constructor ´ë½Å¿¡ Á¦°øµË´Ï´Ù.

ÆÄ¶ó¹ÌÅÍ:
val - µ¹·ÁÁÖ¾îÁö´Â BigInteger ÀÇ °ª
¹Ýȯ°ª:
ÁöÁ¤Ä¡¸¦ »ç¿ëÇÑ BigInteger

add

public BigInteger  add(BigInteger  val)
°ªÀÌ (this + val) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù.

ÆÄ¶ó¹ÌÅÍ:
val - ÀÌ BigInteger ¿¡ °¡»êÇÏ´Â °ª
¹Ýȯ°ª:
this + val

subtract

public BigInteger  subtract(BigInteger  val)
°ªÀÌ (this - val) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù.

ÆÄ¶ó¹ÌÅÍ:
val - ÀÌ BigInteger ·ÎºÎÅÍ °¨»êÇÏ´Â °ª
¹Ýȯ°ª:
this - val

multiply

public BigInteger  multiply(BigInteger  val)
°ªÀÌ (this * val) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù.

ÆÄ¶ó¹ÌÅÍ:
val - ÀÌ BigInteger ·Î °ö¼ÀÇÏ´Â °ª
¹Ýȯ°ª:
this * val

divide

public BigInteger  divide(BigInteger  val)
°ªÀÌ (this / val) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù.

ÆÄ¶ó¹ÌÅÍ:
val - ÀÌ BigInteger ¸¦ Á¦»êÇÏ´Â °ª
¹Ýȯ°ª:
this / val
¿¹¿Ü:
ArithmeticException - val==0

divideAndRemainder

public BigInteger [] divideAndRemainder(BigInteger  val)
(this / val) ±×¸®°í (this % val) °è¼ÓµÇ´Â 2 °³ÀÇ BigInteger ÀÇ ¹è¿­À» µ¹·ÁÁÝ´Ï´Ù.

ÆÄ¶ó¹ÌÅÍ:
val - ÀÌ BigInteger ¸¦ Á¦»êÇÏ´Â °ª, ¹× °è»êµÈ À׿©
¹Ýȯ°ª:
2 °³ÀÇ BigInteger ÀÇ ¹è¿­. »ó (this / val) Àº ÃÖÃÊÀÇ ¿ä¼Ò·Î, À׿© (this % val) ´Â ¸¶Áö¸· ¿ä¼Ò
¿¹¿Ü:
ArithmeticException - val==0

remainder

public BigInteger  remainder(BigInteger  val)
°ªÀÌ (this % val) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù.

ÆÄ¶ó¹ÌÅÍ:
val - ÀÌ BigInteger ¸¦ Á¦»êÇÏ´Â °ª, ¹× °è»êµÈ À׿©
¹Ýȯ°ª:
this % val
¿¹¿Ü:
ArithmeticException - val==0

pow

public BigInteger  pow(int exponent)
°ªÀÌ (thisexponent) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù. exponent ´Â BigInteger ´Â ¾Æ´Ï°í Á¤¼öÀÔ´Ï´Ù.

ÆÄ¶ó¹ÌÅÍ:
exponent - ÀÌ BigInteger ¸¦ ´©½ÂÇÏ´Â Áö¼ö
¹Ýȯ°ª:
thisexponent
¿¹¿Ü:
ArithmeticException - exponent °¡ ºÎÀÇ °æ¿ì (ºñÁ¤¼öÄ¡¸¦ »ý¼ºÇÏ´Â ¿¬»êÀÌ »ý±ä´Ù)

gcd

public BigInteger  gcd(BigInteger  val)
°ªÀÌ abs(this) ¿Í abs(val) ÀÇ ÃÖ´ë°ø¾à¼öÀÎ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù. this == 0 && val == 0 ÀÇ °æ¿ì´Â 0 À» µ¹·ÁÁÝ´Ï´Ù.

ÆÄ¶ó¹ÌÅÍ:
val - GCD ·Î °è»êÇÏ´Â °ª
¹Ýȯ°ª:
GCD(abs(this), abs(val))

abs

public BigInteger  abs()
°ªÀÌ ÀÌ BigInteger ÀÇ Àý´ëÄ¡ÀÎ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù.

¹Ýȯ°ª:
abs(this)

negate

public BigInteger  negate()
°ªÀÌ (-this) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù.

¹Ýȯ°ª:
-this

signum

public int signum()
ÀÌ BigInteger ÀÇ ºÎÈ£ ¿ä¼Ò¸¦ µ¹·ÁÁÝ´Ï´Ù.

¹Ýȯ°ª:
ÀÌ BigInteger °¡ ºÎÀÇ °æ¿ì´Â -1, Á¦·ÎÀÇ °æ¿ì´Â 0, Á¤ÀÇ °æ¿ì´Â 1

mod

public BigInteger  mod(BigInteger  m)
°ªÀÌ (this mod m)ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù. ÀÌ ¸Þ¼Òµå´Â Ç×»ó ¡¸ºÎ°¡ ¾Æ´Ï´Ù¡¹ BigInteger ¸¦ µ¹·ÁÁÖ´Â remainder ¿Í´Â ´Ù¸¨´Ï´Ù.

ÆÄ¶ó¹ÌÅÍ:
m - ¸ðÁê¶ó½º
¹Ýȯ°ª:
this mod m
¿¹¿Ü:
ArithmeticException - m <= 0
°ü·Ã Ç׸ñ:
remainder(java.math.BigInteger)

modPow

public BigInteger  modPow(BigInteger  exponent,
                         BigInteger  m)
°ªÀÌ (thisexponent mod m) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù (pow ¿Í ´Þ¸®, ÀÌ ¸Þ¼Òµå´Â ºÎÀÇ Áö¼ö¸¦ Çã¿ë ÇÑ´Ù).

ÆÄ¶ó¹ÌÅÍ:
exponent - Áö¼ö
m - ¸ðÁê¶ó½º
¹Ýȯ°ª:
thisexponent mod m
¿¹¿Ü:
ArithmeticException - m <= 0
°ü·Ã Ç׸ñ:
modInverse(java.math.BigInteger)

modInverse

public BigInteger  modInverse(BigInteger  m)
°ªÀÌ (this-1 mod m) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù.

ÆÄ¶ó¹ÌÅÍ:
m - ¸ðÁê¶ó½º
¹Ýȯ°ª:
this-1 mod m
¿¹¿Ü:
ArithmeticException - m <= 0 À̵簡, ȤÀº ÀÌ BigInteger °¡ mod m ÀÇ °ö¼À ¿ª¼ö¸¦ °¡ÁöÁö ¾Ê´Â °æ¿ì (Áï, ÀÌ BigInteger °¡ m ÀÇ ¡¸¼Ò¼ö¡¹°¡ ¾Æ´Ñ °æ¿ì)

shiftLeft

public BigInteger  shiftLeft(int n)
°ªÀÌ (this << n) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù. ½¬ÇÁÆ® À̵¿·® n °¡ ºÎÀÇ °æ¿ì´Â ÀÌ ¸Þ¼Òµå´Â ¿À¸¥ÂÊ ½¬ÇÁÆ®¸¦ ½ÇÇàÇÕ´Ï´Ù (floor(this * 2n) ¸¦ °è»êÇÑ´Ù).

ÆÄ¶ó¹ÌÅÍ:
n - ºñÆ® ´ÜÀ§¿¡¼­ÀÇ ½¬ÇÁÆ® À̵¿·®
¹Ýȯ°ª:
this << n
°ü·Ã Ç׸ñ:
shiftRight(int)

shiftRight

public BigInteger  shiftRight(int n)
°ªÀÌ (this >> n) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù. ºÎÈ£ È®ÀåÀ» ÇÕ´Ï´Ù. ½¬ÇÁÆ® À̵¿·® n °¡ ºÎÀÇ °æ¿ì´Â ÀÌ ¸Þ¼Òµå´Â ¿ÞÂÊ ½¬ÇÁÆ®¸¦ ½ÇÇàÇÕ´Ï´Ù (floor(this / 2n) ¸¦ °è»êÇÑ´Ù).

ÆÄ¶ó¹ÌÅÍ:
n - ºñÆ® ´ÜÀ§¿¡¼­ÀÇ ½¬ÇÁÆ® À̵¿·®
¹Ýȯ°ª:
this >> n
°ü·Ã Ç׸ñ:
shiftLeft(int)

and

public BigInteger  and(BigInteger  val)
°ªÀÌ (this & val) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù (ÀÌ ¸Þ¼Òµå´Â this ¿Í val ÀÇ ¾çÂÊ ¸ðµÎ°¡ ºÎÀÇ °æ¿ì´Â ºÎÀÇ BigInteger ¸¦ µ¹·ÁÁØ´Ù).

ÆÄ¶ó¹ÌÅÍ:
val - ÀÌ BigInteger ¿ÍÀÇ ³í¸®Ã÷¹«¸¦ Àâ´Â °ª
¹Ýȯ°ª:
this & val

or

public BigInteger  or(BigInteger  val)
°ªÀÌ (this | val) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù (ÀÌ ¸Þ¼Òµå´Â this ¶Ç´Â val °¡ ºÎÀÇ °æ¿ì´Â ºÎÀÇ BigInteger ¸¦ µ¹·ÁÁØ´Ù).

ÆÄ¶ó¹ÌÅÍ:
val - ÀÌ BigInteger ¿ÍÀÇ ³í¸®ÇÕÀ» ÃëÇÏ´Â °ª
¹Ýȯ°ª:
this | val

xor

public BigInteger  xor(BigInteger  val)
°ªÀÌ (this ^ val) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù (ÀÌ ¸Þ¼Òµå´Â this ¿Í val ÀÇ ´Ù¸¥ ÇÑÂʸ¸ÀÌ ºÎÀÇ °æ¿ì¿¡ ºÎÀÇ BigInteger ¸¦ µ¹·ÁÁØ´Ù).

ÆÄ¶ó¹ÌÅÍ:
val - ÀÌ BigInteger ¿ÍÀÇ ¹èŸÀû ³í¸®ÇÕÀ» ÃëÇÏ´Â °ª
¹Ýȯ°ª:
this ^ val

not

public BigInteger  not()
°ªÀÌ (~this) ÀÇ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù (ÀÌ ¸Þ¼Òµå´Â ÀÌ BigInteger °¡ ºÎ°¡ ¾Æ´Ñ °æ¿ì¿¡ ºÎÀÇ °ªÀ» µ¹·ÁÁØ´Ù).

¹Ýȯ°ª:
~this

andNot

public BigInteger  andNot(BigInteger  val)
°ªÀÌ (this & ~val) ÀÎ BigInteger ¸¦ µ¹·ÁÁÝ´Ï´Ù. and(val.not()) ¿Í µ¿µîÀÇ ÀÌ ¸Þ¼Òµå´Â ¸¶½ºÅ· ¿¬»êÀÇ ÆíÀǸ¦ ²ÒÇϱâ À§Çؼ­(¶§¹®¿¡) Á¦°øµÇ°í ÀÖ½À´Ï´Ù (ÀÌ ¸Þ¼Òµå´Â this °¡ ºÎ·Î val °¡ Á¤ÀÇ °æ¿ì¿¡ ºÎÀÇ BigInteger ¼öÄ¡¸¦ µ¹·ÁÁØ´Ù).

ÆÄ¶ó¹ÌÅÍ:
val - ÀÌ BigInteger ·Î º¸¼ö°¡ ÃëÇØÁ® ³í¸®ÀûÀÌ ÃëÇØÁö´Â °ª
¹Ýȯ°ª:
this & ~val

testBit

public boolean testBit(int n)
ÁöÁ¤µÈ ºñÆ®°¡ ¼³Á¤µÇ¾î ÀÖ´Â °æ¿ì¿¡¸¸ true ¸¦ µ¹·ÁÁÝ´Ï´Ù ((this & (1<<n)) ! = 0) À» °è»êÇÑ´Ù).

ÆÄ¶ó¹ÌÅÍ:
n - Å×½ºÆ®ÇÏ´Â ºñÆ®ÀÇ À妽º
¹Ýȯ°ª:
ÁöÁ¤µÈ ºñÆ®°¡ ¼³Á¤µÇ¾î ÀÖ´Â °æ¿ì¿¡¸¸ true
¿¹¿Ü:
ArithmeticException - n °¡ ºÎÀÇ °æ¿ì

setBit

public BigInteger  setBit(int n)
°ªÀÌ ÀÌ BigInteger ¿¡ µ¿ÀÏÇÑ BigInteger ¸¦, ÁöÁ¤µÈ ºñÆ®¸¦ ¼³Á¤ÇØ µ¹·ÁÁÝ´Ï´Ù ((this | (1<<n)) ¸¦ °è»êÇÑ´Ù).

ÆÄ¶ó¹ÌÅÍ:
n - ¼³Á¤ÇÏ´Â ºñÆ®ÀÇ À妽º
¹Ýȯ°ª:
this | (1<<n)
¿¹¿Ü:
ArithmeticException - n °¡ ºÎÀÇ °æ¿ì

clearBit

public BigInteger  clearBit(int n)
°ªÀÌ ÀÌ BigInteger ¿¡ µ¿ÀÏÇÑ BigInteger ¸¦, ÁöÁ¤µÈ ºñÆ®¸¦ Ŭ¸®¾î ÇØ µ¹·ÁÁÝ´Ï´Ù ((this & ~(1<<n)) ¸¦ °è»êÇÑ´Ù).

ÆÄ¶ó¹ÌÅÍ:
n - Ŭ¸®¾î ÇÏ´Â ºñÆ®ÀÇ À妽º
¹Ýȯ°ª:
this & ~(1<<n)
¿¹¿Ü:
ArithmeticException - n °¡ ºÎÀÇ °æ¿ì

flipBit

public BigInteger  flipBit(int n)
°ªÀÌ ÀÌ BigInteger ¿¡ µ¿ÀÏÇÑ BigInteger ¸¦, ÁöÁ¤µÈ ºñÆ®¸¦ ¹ÝÀü½ÃÄÑ µ¹·ÁÁÝ´Ï´Ù ((this ^ (1<<n)) ¸¦ °è»êÇÑ´Ù).

ÆÄ¶ó¹ÌÅÍ:
n - ¹ÝÀüÇÏ´Â ºñÆ®ÀÇ À妽º
¹Ýȯ°ª:
this ^ (1<<n)
¿¹¿Ü:
ArithmeticException - n °¡ ºÎÀÇ °æ¿ì

getLowestSetBit

public int getLowestSetBit()
ÀÌ BigInteger ÀÇ °¡Àå ¿ìÃø (1 ¹ø ³·Àº À§)ÀÇ 1 ºñÆ®ÀÇ À妽º (°¡Àå ¿ìÃøÀÇ 1 ºñÆ®ÀÇ ¿ìÃøÇâÀÇ 0 ºñÆ®ÀÇ ¼ö)¸¦ µ¹·ÁÁÝ´Ï´Ù. ÀÌ BigInteger ¿¡ 1 ºñÆ®°¡ 1 °³µµ Æ÷ÇÔµÇÁö ¾Ê´Â °æ¿ì´Â -1 À» µ¹·ÁÁÝ´Ï´Ù ((this==0? -1 : log2(this & -this)) ¸¦ °è»êÇÑ´Ù).

¹Ýȯ°ª:
ÀÌ BigInteger ÀÇ °¡Àå ¿ìÃøÀÇ 1 ºñÆ®ÀÇ À妽º

bitLength

public int bitLength()
ÀÌ BigInteger ÀÇ ÃÖ¼ÒÀÇ 2 ÀÇ º¸¼ö Ç¥Çö³»ÀÇ ºñÆ®¼ö¸¦ µ¹·ÁÁÝ´Ï´Ù. ´Ù¸¸, ºÎÈ£ ºñÆ®¸¦ Á¦¿ÜÇÕ´Ï´Ù. Á¤ÀÇ BigInteger ¿¡ ´ëÇØ¼­´Â Åë»óÀÇ 2 ÁøÇ¥Çö¿¡ À־ÀÇ ºñÆ®ÀÇ ¼ö¿¡ µ¿ÀÏÇØÁý´Ï´Ù ((ceil(log2(this < 0 ? -this : this+1))) ¸¦ °è»êÇÑ´Ù).

¹Ýȯ°ª:
ÀÌ BigInteger ÀÇ ÃÖ¼ÒÀÇ 2 ÀÇ º¸¼ö Ç¥Çö³»ÀÇ ºñÆ®ÀÇ ¼ö. ´Ù¸¸ ºÎÈ£ ºñÆ®´Â Á¦¿ÜÇÏ´Ù

bitCount

public int bitCount()
ÀÌ BigInteger ÀÇ 2 ÀÇ º¸¼ö Ç¥Çö³»ÀÇ, ºÎÈ£ ºñÆ®¿Í ´Ù¸¥ ºñÆ®ÀÇ ¼ö¸¦ µ¹·ÁÁÝ´Ï´Ù. ÀÌ ¸Þ¼Òµå´Â BigInteger »ó¿¡ ºñÆ® º¤ÅÍ Çü½ÄÀÇ ¼³Á¤À» ±¸ÇöÇÏ´Â °æ¿ì¿¡ Æí¸®ÇÕ´Ï´Ù.

¹Ýȯ°ª:
ÀÌ BigInteger ÀÇ 2 ÀÇ º¸¼ö Ç¥Çö³»ÀÇ, ºÎÈ£ ºñÆ®¿Í ´Ù¸¥ ºñÆ®ÀÇ ¼ö

isProbablePrime

public boolean isProbablePrime(int certainty)
ÀÌ BigInteger °¡ ¼Ò¼öÀÏ °¡´É¼ºÀÌ ³ôÀº °æ¿ì´Â true ¸¦ µ¹·ÁÁÖ¾î, ¹Ýµå½Ã ÇÕ¼º¼öÀÎ °æ¿ì´Â false ¸¦ µ¹·ÁÁÝ´Ï´Ù.

ÆÄ¶ó¹ÌÅÍ:
certainty - È£ÃâÃøÀÌ Çã¿ë ÇÏÁö ¾Ê´Â È®·üÀÇ Ã´µµ. ÀÌ BigInteger °¡ ¼Ò¼öÀÎ È®·üÀÌ (1 - 1/2certainty) ¸¦ ³Ñ´Â °æ¿ì´Â true ¸¦ µ¹·ÁÁØ´Ù. ½ÇÇà ½Ã°£Àº ÀÌ ÆÄ¶ó¹ÌÅÍÀÇ °ª ¿¡ ºñ·ÊÇÑ´Ù
¹Ýȯ°ª:
ÀÌ BigInteger °¡ ¼Ò¼öÀÏ °¡´É¼ºÀÌ ³ôÀº °æ¿ì´Â true, ¹Ýµå½Ã ÇÕ¼º¼öÀÎ °æ¿ì´Â false

compareTo

public int compareTo(BigInteger  val)
ÀÌ BigInteger °¡ ÁöÁ¤µÈ BigInteger ¿Í ºñ±³ÇÕ´Ï´Ù. ÀÌ ¸Þ¼Òµå´Â 6 °³ÀÇ boolean ÇüÀÇ ºñ±³ ¿¬»êÀÚ (<,==, >, >=,! =, <=)ÀÇ °¢°¢ ´ëÇÏ´Â °³°³ÀÇ ¸Þ¼Òµå ´ë½Å¿¡ Á¦°øµË´Ï´Ù. ÀÌ·¯ÇÑ ºñ±³¸¦ ½Ç½ÃÇÏ·Á¸é (x.compareTo(y) <op> 0) ¶ó°í ÇÏ´Â Æí¼ºÀ» ÃßõÇÕ´Ï´Ù. ÀÌ °æ¿ì, <op> ¿¡´Â 6 °³ÀÇ ¿¬»êÀÚ °¡¿îµ¥ 1 °³°¡ µé¾î°©´Ï´Ù.

ÆÄ¶ó¹ÌÅÍ:
val - ÀÌ BigInteger ¿Í ºñ±³ÇÏ´Â BigInteger
¹Ýȯ°ª:
ÀÌ BigInteger ÀÇ °ªÀÌ val º¸´Ù ÀÛÀº °æ¿ì´Â -1, µ¿ÀÏÇÑ °æ¿ì´Â 0, Å« °æ¿ì´Â 1

compareTo

public int compareTo(Object  o)
ÀÌ BigInteger ¸¦ ÁöÁ¤ÇÑ Object ¿Í ºñ±³ÇÕ´Ï´Ù. Object °¡ BigInteger ÀÇ °æ¿ì, ÀÌ ¸Þ¼Òµå´Â compareTo(BigInteger) ¿Í °°ÀÌ µ¿ÀÛÇØ, ±× ÀÌ¿ÜÀÇ °æ¿ì´Â ClassCastException ¸¦ ½½·Î¿ì ÇÕ´Ï´Ù (BigInteger ´Â ´Ù¸¥ BigInteger ·Î ¹Û¿¡ ºñ±³ÇÒ ¼ö ¾ø´Ù).

Á¤ÀÇ:
ÀÎÅÍÆäÀ̽º Comparable ³»ÀÇ compareTo
ÆÄ¶ó¹ÌÅÍ:
o - ÀÌ BigInteger ¿Í ºñ±³ÇÏ´Â Object
¹Ýȯ°ª:
ÀÌ BigInteger ÀÇ °ªÀÌ o º¸´Ù ÀÛÀº °æ¿ì´Â ºÎÀÇ ¼ö, µ¿ÀÏÇÑ °æ¿ì´Â 0, Å« °æ¿ì´Â Á¤ÀÇ ¼ö. o ´Â BigInteger °¡ ¾Æ´Ï¸é ¾ÈµÈ´Ù
¿¹¿Ü:
ClassCastException - o °¡ BigInteger °¡ ¾Æ´Ñ °æ¿ì
µµÀÔµÈ ¹öÁ¯:
1.2
°ü·Ã Ç׸ñ:
compareTo(java.math.BigInteger) , Comparable

equals

public boolean equals(Object  x)
ÀÌ BigInteger ¿Í ÁöÁ¤µÈ Object °¡ µ¿ÀÏÇÑÁö ¾î¶²Áö¸¦ ºñ±³ÇÕ´Ï´Ù.

¿À¹ö¶óÀ̵å(override):
Ŭ·¡½º Object ³»ÀÇ equals
ÆÄ¶ó¹ÌÅÍ:
x - ÀÌ BigInteger ¿Í ºñ±³ÇÏ´Â Object
¹Ýȯ°ª:
ÁöÁ¤µÈ Object °¡, ÀÌ BigInteger ¿Í °ªÀÌ µ¿ÀÏÇÑ BigInteger ÀÎ °æ¿ì¿¡¸¸ true
°ü·Ã Ç׸ñ:
Object.hashCode() , Hashtable

min

public BigInteger  min(BigInteger  val)
ÀÌ BigInteger ¿Í val ÀÇ ÃÖ¼ÒÄ¡¸¦ µ¹·ÁÁÝ´Ï´Ù.

ÆÄ¶ó¹ÌÅÍ:
val - ÃÖ¼ÒÄ¡¸¦ °è»êÇÏ´Â °ª
¹Ýȯ°ª:
ÀÌ BigInteger ¿Í val °¡¿îµ¥·Î ÀÛÀº (ºÐ)ÆíÀÇ °ªÀ» °¡Áö´Â BigInteger. °ªÀÌ µ¿ÀÏÇÑ °æ¿ì´Â ¾î´À ÂÊÀÎÁö°¡ µ¹·ÁÁÖ¾îÁø´Ù

max

public BigInteger  max(BigInteger  val)
ÀÌ BigInteger ¿Í val ÀÇ ÃÖ´ëÄ¡¸¦ µ¹·ÁÁÝ´Ï´Ù.

ÆÄ¶ó¹ÌÅÍ:
val - ÃÖ´ëÄ¡¸¦ °è»êÇÏ´Â °ª
¹Ýȯ°ª:
ÀÌ BigInteger ¿Í val °¡¿îµ¥·Î Å« (ºÐ)ÆíÀÇ °ªÀ» °¡Áö´Â BigInteger. °ªÀÌ µ¿ÀÏÇÑ °æ¿ì´Â ¾î´À ÂÊÀÎÁö°¡ µ¹·ÁÁÖ¾îÁø´Ù

hashCode

public int hashCode()
ÀÌ BigInteger ÀÇ ÇØ½Ã Äڵ带 µ¹·ÁÁÝ´Ï´Ù.

¿À¹ö¶óÀ̵å(override):
Ŭ·¡½º Object ³»ÀÇ hashCode
¹Ýȯ°ª:
ÀÌ BigInteger ÀÇ ÇØ½Ã ÄÚµå
°ü·Ã Ç׸ñ:
Object.equals(java.lang.Object) , Hashtable

toString

public String  toString(int radix)
ÁöÁ¤µÈ ±â¼ö³»ÀÇ ÀÌ BigInteger ÀÇ String Ç¥ÇöÀ» µ¹·ÁÁÝ´Ï´Ù. ±â¼ö°¡ Character.MIN_RADIX (2) ~ Character.MAX_RADIX (36)ÀÇ ¹üÀ§¿ÜÀÇ °æ¿ì´Â µðÆúÆ®¸¦ 10 À¸·Î ¼³Á¤ÇÕ´Ï´Ù (Integer.toString ÀÇ °æ¿ì¿Í °°´Ù). Character.forDigit ¿¡ ÀÇÇÑ ¼ýÀڷκÎÅÍ Ä³¸¯ÅÍ¿¡ÀÇ ¸ÅÇÎÀÌ »ç¿ëµÇ¾î Çʿ信 µû¶ó¼­ ¸¶À̳ʽº ºÎÈ£¸¦ Àü¿¡ ºÙÀÏ ¼ö ÀÖ½À´Ï´Ù (ÀÌ Ç¥ÇöÀº String ¿Í int ¸¦ Àμö·Î ÇÏ´Â constructor °ú ȣȯ¼ºÀÌ ÀÖ´Ù).

ÆÄ¶ó¹ÌÅÍ:
radix - String Ç¥ÇöÀÇ ±â¼ö
¹Ýȯ°ª:
ÁöÁ¤µÈ ±â¼ö³»ÀÇ ÀÌ BigInteger ÀÇ String Ç¥Çö
°ü·Ã Ç׸ñ:
Integer.toString(int, int) , Character.forDigit(int, int) , BigInteger(java.lang.String, int)

toString

public String  toString()
ÀÌ BigInteger ÀÇ 10 Áø String Ç¥ÇöÀ» µ¹·ÁÁÝ´Ï´Ù. Character.forDigit ¿¡ ÀÇÇÑ ¼ýÀڷκÎÅÍ Ä³¸¯ÅÍ¿¡ÀÇ ¸ÅÇÎÀÌ »ç¿ëµÇ¾î Çʿ信 µû¶ó¼­ ¸¶À̳ʽº ºÎÈ£¸¦ Àü¿¡ ºÙÀÏ ¼ö ÀÖ½À´Ï´Ù (ÀÌ Ç¥ÇöÀº String ¸¦ Àμö·Î ÇÏ´Â constructor °ú ȣȯ¼ºÀÌ ÀÖ¾î, Java ÀÇ + ¿¬»êÀÚ¿ÍÀÇ ¿¬°áÀ» °í·ÁÇÑ °ÍÀÌ´Ù).

¿À¹ö¶óÀ̵å(override):
Ŭ·¡½º Object ³»ÀÇ toString
¹Ýȯ°ª:
ÀÌ BigInteger ÀÇ 10 Áø¼öÀÇ String Ç¥Çö
°ü·Ã Ç׸ñ:
Character.forDigit(int, int) , BigInteger(java.lang.String)

toByteArray

public byte[] toByteArray()
ÀÌ BigInteger ÀÇ 2 ÀÇ º¸¼ö Ç¥ÇöÀ» Æ÷ÇÔÇÑ ¹ÙÀÌÆ® ¹è¿­À» µ¹·ÁÁÝ´Ï´Ù. ¹ÙÀÌÆ® ¹è¿­Àº ¡¸ºò endian¡¹ÀÇ ¹ÙÀÌÆ® ¼ø¼­ÀÔ´Ï´Ù (ÃÖ»óÁ¤µµÀÇ ¹ÙÀÌÆ®´Â [0] ¹øÂ°ÀÇ ¿ä¼Ò). ¹è¿­¿¡´Â ÃÖÀú 1 °³ÀÇ ºÎÈ£ ºñÆ®¸¦ Æ÷ÇÔÇÑ ÀÌ BigInteger ÀÇ Ç¥Çö¿¡ ÇÊ¿äÇÑ ÃÖ¼ÒÀÇ ¹ÙÀÌÆ®¼ö ((ceil((this.bitLength() + 1)/8)))°¡ Æ÷ÇԵ˴ϴ٠(ÀÌ Ç¥ÇöÀº byte[] ¸¦ Àμö·Î ÇÏ´Â constructor °ú ȣȯ¼ºÀÌ ÀÖ´Ù).

¹Ýȯ°ª:
ÀÌ BigInteger ÀÇ 2 ÀÇ º¸¼ö Ç¥ÇöÀ» Æ÷ÇÔÇÑ ¹ÙÀÌÆ® ¹è¿­
°ü·Ã Ç׸ñ:
BigInteger(byte[])

intValue

public int intValue()
ÀÌ BigInteger ¸¦ int ·Î º¯È¯ÇÕ´Ï´Ù. À̰ÍÀº ¡¸Java ¾ð¾î »ç¾ç¡¹À¸·Î Á¤Àǵǰí Àִ ǥÁØÀÇ ¡¸³×·Î¿ì ¿ø½ÃÀû º¯È¯¡¹ÀÔ´Ï´Ù. ÀÌ BigInteger °¡ ³Ê¹« Ä¿ int ¿¡ ÀûÇÕÇÏÁö ¾Ê´Â °æ¿ì´Â ÇÏÀ§ÀÇ 32 ºñÆ®¸¸ÀÌ µ¹·ÁÁÖ¾îÁý´Ï´Ù.

Á¤ÀÇ:
Ŭ·¡½º Number ³»ÀÇ intValue
¹Ýȯ°ª:
int ¿¡ º¯È¯µÈ ÀÌ BigInteger

longValue

public long longValue()
ÀÌ BigInteger ¸¦ long ·Î º¯È¯ÇÕ´Ï´Ù. À̰ÍÀº ¡¸Java ¾ð¾î »ç¾ç¡¹À¸·Î Á¤Àǵǰí Àִ ǥÁØÀÇ ¡¸³×·Î¿ì ¿ø½ÃÀû º¯È¯¡¹ÀÔ´Ï´Ù. ÀÌ BigInteger °¡ ³Ê¹« Ä¿ long ¿¡ ÀûÇÕÇÏÁö ¾Ê´Â °æ¿ì´Â ÇÏÀ§ÀÇ 64 ºñÆ®¸¸ÀÌ µ¹·ÁÁÖ¾îÁý´Ï´Ù.

Á¤ÀÇ:
Ŭ·¡½º Number ³»ÀÇ longValue
¹Ýȯ°ª:
long ¿¡ º¯È¯µÈ ÀÌ BigInteger

floatValue

public float floatValue()
ÀÌ BigInteger ¸¦ float ·Î º¯È¯ÇÕ´Ï´Ù. À̰ÍÀº ¡¸Java ¾ð¾î »ç¾ç¡¹À¸·Î Á¤Àǵǰí ÀÖ´Â double ·ÎºÎÅÍ float ¿¡ÀÇ ¡¸³×·Î¿ì ¿ø½ÃÀû º¯È¯¡¹¿¡ À¯»çÇϰí ÀÖ½À´Ï´Ù. ÀÌ BigInteger ÀÇ Àý´ëÄ¡°¡ ³Ê¹« Ä¿ float ·Î¼­ ³ªÅ¸³¾ ¼ö°¡ ¾ø´Â °æ¿ì¿¡´Â Á¤ ¶Ç´Â ºÎÀÇ ¹«ÇÑ´ë¿¡ º¯È¯µË´Ï´Ù.

Á¤ÀÇ:
Ŭ·¡½º Number ³»ÀÇ floatValue
¹Ýȯ°ª:
float ¿¡ º¯È¯µÈ ÀÌ BigInteger

doubleValue

public double doubleValue()
ÀÌ BigInteger ¸¦ double ·Î º¯È¯ÇÕ´Ï´Ù. À̰ÍÀº ¡¸Java ¾ð¾î »ç¾ç¡¹À¸·Î Á¤Àǵǰí ÀÖ´Â double ·ÎºÎÅÍ float ¿¡ÀÇ ¡¸³×·Î¿ì ¿ø½ÃÀû º¯È¯¡¹¿¡ À¯»çÇϰí ÀÖ½À´Ï´Ù. ÀÌ BigInteger ÀÇ Àý´ëÄ¡°¡ ³Ê¹« Ä¿ double ·Î¼­ ³ªÅ¸³¾ ¼ö°¡ ¾ø´Â °æ¿ì¿¡´Â Á¤ ¶Ç´Â ºÎÀÇ ¹«ÇÑ´ë¿¡ º¯È¯µË´Ï´Ù.

Á¤ÀÇ:
Ŭ·¡½º Number ³»ÀÇ doubleValue
¹Ýȯ°ª:
double ¿¡ º¯È¯µÈ ÀÌ BigInteger

JavaTM 2
Platform
Std.  Ed.  v1. 4.0

¹ö±×ÀÇ º¸°í¿Í ±â´ÉÀÇ ¸®Äù½ºÆ®
ÀÌ¿ÜÀÇ API ·¹ÆÛ·±½º ¹× °³¹ßÀÚ¿ë ¹®¼­¿¡ ´ëÇØ¼­´Â Java 2 SDK SE °³¹ßÀÚ¿ë ¹®¼­¸¦ ÂüÁ¶ÇØ ÁÖ¼¼¿ä. °³¹ßÀÚÀü¿ëÀÇ »ó¼¼ÇÑ ÇØ¼³, °³³äÀÇ °³¿ä, ¿ë¾îÀÇ Á¤ÀÇ, ¹ö±×ÀÇ È¸ÇÇÃ¥, ¹× ÄÚµå ½Ç·Ê°¡ Æ÷ÇԵǾî ÀÖ½À´Ï´Ù.

Java, Java 2 D, ¹× JDBC ´Â ¹Ì±¹ ¹× ±× ¿ÜÀÇ ³ª¶ó¿¡ À־ÀÇ ¹Ì±¹ Sun Microsystems, Inc. ÀÇ »óÇ¥ ȤÀº µî·Ï»óÇ¥ÀÔ´Ï´Ù.
Copyright 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.