|
JavaTM 2 Platform Std. Ed. v1. 4.0 |
||||||||||
ÀüÀÇ Å¬·¡½º ´ÙÀ½ÀÇ Å¬·¡½º | ÇÁ·¹ÀÓ ÀÖ¾î ÇÁ·¹ÀÓ ¾øÀ½ | ||||||||||
°³¿ä: »óÀÚ | Çʵå | constructor | ¸Þ¼Òµå | »ó¼¼: Çʵå | constructor | ¸Þ¼Òµå |
java.lang.Object | +--java.lang.Number | +--java.math.BigInteger
º¯°æÀÌ ºÒ°¡´ÉÇÑ, ÀÓÀÇ Á¤¹ÐµµÀÇ Á¤¼öÀÔ´Ï´Ù. ¸ðµç ¿¬»êÀº 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
¸¦ ½½·Î¿ì ÇÕ´Ï´Ù.
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 |
ÇʵåÀÇ »ó¼¼ |
public static final BigInteger ZERO
public static final BigInteger ONE
»ý¼ºÀÚÀÇ »ó¼¼ |
public BigInteger(byte[] val)
val
- BigInteger ÀÇ, ºò endian 2 ÀÇ º¸¼ö ¹ÙÀ̳ʸ® Ç¥Çö
NumberFormatException
- val ÀÇ ±æÀ̰¡ 0 ¹ÙÀÌÆ®ÀÇ °æ¿ìpublic BigInteger(int signum, byte[] magnitude)
signum
- ¼ýÀÚÀÇ ºÎÈ£ (ºÎ´Â -1, Á¦·Î´Â 0, Á¤Àº 1)magnitude
- ¼ýÀÚÀÇ Àý´ëÄ¡ÀÇ ºò endian ¹ÙÀ̳ʸ® Ç¥Çö
NumberFormatException
- signum °¡ 3 °³ÀÇ À¯È¿ÇÑ °ª (-1, 0, 1)ÀÇ ¾î¶² °Íµµ ¾Æ´ÑÁö signum °¡ 0 À¸·Î,magnitude ¿¡ 1 °³ ÀÌ»óÀÇ 0 ÀÌ¿ÜÀÇ ¹ÙÀÌÆ®°¡ Æ÷ÇԵǾî ÀÖ´Â °æ¿ìpublic BigInteger(String val, int radix)
val
- BigInteger ÀÇ String Ç¥Çöradix
- val ÀÇ ÇØ¼®À¸·Î »ç¿ëµÇ´Â ±â¼ö
NumberFormatException
- val °¡ ÁöÁ¤ÇÑ ±â¼ö³»ÀÇ BigInteger ÀÇ À¯È¿ÇÑ Ç¥ÇöÀÌ ¾Æ´ÑÁö radix °¡ Character.MIN_RADIX (2) ~ Character.MAX_RADIX (36)ÀÇ ¹üÀ§¿Ü¿¡ ÀÖ´Â °æ¿ìCharacter.digit(char, int)
public BigInteger(String val)
val
- BigInteger ÀÇ 10 Áø¼öÀÇ String Ç¥Çö
NumberFormatException
- val ´Â BigInteger ÀÇ Ç¥ÇöÀ¸·Î¼´Â ¹«È¿ÀÎCharacter.digit(char, int)
public BigInteger(int numBits, Random rnd)
numBits
- »õ·Î¿î BigInteger ÀÇ ÃÖ´ë ºñÆ®¼örnd
- »õ·Î¿î BigInteger ÀÇ °è»êÀ¸·Î »ç¿ëµÇ´Â ·£´ý ºñÆ®ÀÇ ¼Ò½º
IllegalArgumentException
- numBits °¡ ºÎÀÇ °æ¿ìbitLength()
public BigInteger(int bitLength, int certainty, Random rnd)
È®·üÀ» ÁöÁ¤ÇÒ Çʿ䰡 ¾ø´Â °æ¿ì´Â ÀÌ constructor Àº ¾Æ´Ï°í probablePrime ¸Þ¼Òµå¸¦ »ç¿ëÇÏ´Â °ÍÀ» ÃßõÇÕ´Ï´Ù.
bitLength
- µ¹·ÁÁÖ¾îÁö´Â BigInteger ÀÇ bit lengthcertainty
- È£ÃâÃøÀÌ Çã¿ë ÇÏÁö ¾Ê´Â È®·üÀÇ Ã´µµ. »õ·Î¿î BigInteger °¡ ¼Ò¼öÀÎ È®·üÀº (1 - 1/2certainty)º¸´Ù Å©´Ù. ÀÌ instructorÀÇ ½ÇÇà ½Ã°£Àº ÀÌ ÆÄ¶ó¹ÌÅÍÀÇ °ª ¿¡ ºñ·ÊÇÏ´Ârnd
- ¼Ò¼öµµ¸¦ Å×½ºÆ®ÇÏ´Â Èĺ¸ÀÇ ¼±ÅÃÀ¸·Î »ç¿ëµÇ´Â ·£´ý ºñÆ®ÀÇ ¼Ò½º
ArithmeticException
- bitLength < 2bitLength()
¸Þ¼ÒµåÀÇ »ó¼¼ |
public static BigInteger probablePrime(int bitLength, Random rnd)
bitLength
- µ¹·ÁÁÖ¾îÁö´Â BigInteger ÀÇ bit lengthrnd
- ¼Ò¼öµµ¸¦ Å×½ºÆ®ÇÏ´Â Èĺ¸ÀÇ ¼±ÅÃÀ¸·Î »ç¿ëµÇ´Â ·£´ý ºñÆ®ÀÇ ¼Ò½º
ArithmeticException
- bitLength < 2bitLength()
public static BigInteger valueOf(long val)
val
- µ¹·ÁÁÖ¾îÁö´Â BigInteger ÀÇ °ª
public BigInteger add(BigInteger val)
val
- ÀÌ BigInteger ¿¡ °¡»êÇÏ´Â °ª
public BigInteger subtract(BigInteger val)
val
- ÀÌ BigInteger ·ÎºÎÅÍ °¨»êÇÏ´Â °ª
public BigInteger multiply(BigInteger val)
val
- ÀÌ BigInteger ·Î °ö¼ÀÇÏ´Â °ª
public BigInteger divide(BigInteger val)
val
- ÀÌ BigInteger ¸¦ Á¦»êÇÏ´Â °ª
ArithmeticException
- val==0public BigInteger [] divideAndRemainder(BigInteger val)
val
- ÀÌ BigInteger ¸¦ Á¦»êÇÏ´Â °ª, ¹× °è»êµÈ À׿©
ArithmeticException
- val==0public BigInteger remainder(BigInteger val)
val
- ÀÌ BigInteger ¸¦ Á¦»êÇÏ´Â °ª, ¹× °è»êµÈ À׿©
ArithmeticException
- val==0public BigInteger pow(int exponent)
exponent
- ÀÌ BigInteger ¸¦ ´©½ÂÇÏ´Â Áö¼ö
ArithmeticException
- exponent °¡ ºÎÀÇ °æ¿ì (ºñÁ¤¼öÄ¡¸¦ »ý¼ºÇÏ´Â ¿¬»êÀÌ »ý±ä´Ù)public BigInteger gcd(BigInteger val)
val
- GCD ·Î °è»êÇÏ´Â °ª
public BigInteger abs()
public BigInteger negate()
public int signum()
public BigInteger mod(BigInteger m)
m
- ¸ðÁê¶ó½º
ArithmeticException
- m <= 0remainder(java.math.BigInteger)
public BigInteger modPow(BigInteger exponent, BigInteger m)
exponent
- Áö¼öm
- ¸ðÁê¶ó½º
ArithmeticException
- m <= 0modInverse(java.math.BigInteger)
public BigInteger modInverse(BigInteger m)
m
- ¸ðÁê¶ó½º
ArithmeticException
- m <= 0 À̵簡, ȤÀº ÀÌ BigInteger °¡ mod m ÀÇ °ö¼À ¿ª¼ö¸¦ °¡ÁöÁö ¾Ê´Â °æ¿ì (Áï, ÀÌ BigInteger °¡ m ÀÇ ¡¸¼Ò¼ö¡¹°¡ ¾Æ´Ñ °æ¿ì)public BigInteger shiftLeft(int n)
n
- ºñÆ® ´ÜÀ§¿¡¼ÀÇ ½¬ÇÁÆ® À̵¿·®
shiftRight(int)
public BigInteger shiftRight(int n)
n
- ºñÆ® ´ÜÀ§¿¡¼ÀÇ ½¬ÇÁÆ® À̵¿·®
shiftLeft(int)
public BigInteger and(BigInteger val)
val
- ÀÌ BigInteger ¿ÍÀÇ ³í¸®Ã÷¹«¸¦ Àâ´Â °ª
public BigInteger or(BigInteger val)
val
- ÀÌ BigInteger ¿ÍÀÇ ³í¸®ÇÕÀ» ÃëÇÏ´Â °ª
public BigInteger xor(BigInteger val)
val
- ÀÌ BigInteger ¿ÍÀÇ ¹èŸÀû ³í¸®ÇÕÀ» ÃëÇÏ´Â °ª
public BigInteger not()
public BigInteger andNot(BigInteger val)
val
- ÀÌ BigInteger ·Î º¸¼ö°¡ ÃëÇØÁ® ³í¸®ÀûÀÌ ÃëÇØÁö´Â °ª
public boolean testBit(int n)
n
- Å×½ºÆ®ÇÏ´Â ºñÆ®ÀÇ À妽º
ArithmeticException
- n °¡ ºÎÀÇ °æ¿ìpublic BigInteger setBit(int n)
n
- ¼³Á¤ÇÏ´Â ºñÆ®ÀÇ À妽º
ArithmeticException
- n °¡ ºÎÀÇ °æ¿ìpublic BigInteger clearBit(int n)
n
- Ŭ¸®¾î ÇÏ´Â ºñÆ®ÀÇ À妽º
ArithmeticException
- n °¡ ºÎÀÇ °æ¿ìpublic BigInteger flipBit(int n)
n
- ¹ÝÀüÇÏ´Â ºñÆ®ÀÇ À妽º
ArithmeticException
- n °¡ ºÎÀÇ °æ¿ìpublic int getLowestSetBit()
public int bitLength()
public int bitCount()
public boolean isProbablePrime(int certainty)
certainty
- È£ÃâÃøÀÌ Çã¿ë ÇÏÁö ¾Ê´Â È®·üÀÇ Ã´µµ. ÀÌ BigInteger °¡ ¼Ò¼öÀÎ È®·üÀÌ (1 - 1/2certainty) ¸¦ ³Ñ´Â °æ¿ì´Â true ¸¦ µ¹·ÁÁØ´Ù. ½ÇÇà ½Ã°£Àº ÀÌ ÆÄ¶ó¹ÌÅÍÀÇ °ª ¿¡ ºñ·ÊÇÑ´Ù
public int compareTo(BigInteger val)
val
- ÀÌ BigInteger ¿Í ºñ±³ÇÏ´Â BigInteger
public int compareTo(Object o)
Comparable
³»ÀÇ compareTo
o
- ÀÌ BigInteger ¿Í ºñ±³ÇÏ´Â Object
ClassCastException
- o °¡ BigInteger °¡ ¾Æ´Ñ °æ¿ìcompareTo(java.math.BigInteger)
,
Comparable
public boolean equals(Object x)
Object
³»ÀÇ equals
x
- ÀÌ BigInteger ¿Í ºñ±³ÇÏ´Â Object
Object.hashCode()
,
Hashtable
public BigInteger min(BigInteger val)
val
- ÃÖ¼ÒÄ¡¸¦ °è»êÇÏ´Â °ª
public BigInteger max(BigInteger val)
val
- ÃÖ´ëÄ¡¸¦ °è»êÇÏ´Â °ª
public int hashCode()
Object
³»ÀÇ hashCode
Object.equals(java.lang.Object)
,
Hashtable
public String toString(int radix)
radix
- String Ç¥ÇöÀÇ ±â¼ö
Integer.toString(int, int)
,
Character.forDigit(int, int)
,
BigInteger(java.lang.String, int)
public String toString()
Object
³»ÀÇ toString
Character.forDigit(int, int)
,
BigInteger(java.lang.String)
public byte[] toByteArray()
BigInteger(byte[])
public int intValue()
Number
³»ÀÇ intValue
public long longValue()
Number
³»ÀÇ longValue
public float floatValue()
Number
³»ÀÇ floatValue
public double doubleValue()
Number
³»ÀÇ doubleValue
|
JavaTM 2 Platform Std. Ed. v1. 4.0 |
||||||||||
ÀüÀÇ Å¬·¡½º ´ÙÀ½ÀÇ Å¬·¡½º | ÇÁ·¹ÀÓ ÀÖ¾î ÇÁ·¹ÀÓ ¾øÀ½ | ||||||||||
°³¿ä: »óÀÚ | Çʵå | constructor | ¸Þ¼Òµå | »ó¼¼: Çʵå | constructor | ¸Þ¼Òµå |
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.