Last login: Thu Oct 14 08:21:05 on ttys003 The default interactive shell is now zsh. To update your account to use zsh, please run `chsh -s /bin/zsh`. For more details, please visit https://support.apple.com/kb/HT208050. (base) MAC:Thu Oct 14:10:43:~> jshell | Welcome to JShell -- Version 15.0.1 | For an introduction type: /help intro jshell> BigInteger.ONE $1 ==> 1 jshell> BigInteger.TWO $2 ==> 2 jshell> BigInteger.TWO = 5 | Error: | cannot assign a value to final variable TWO | BigInteger.TWO = 5 | ^------------^ | Error: | incompatible types: int cannot be converted to java.math.BigInteger | BigInteger.TWO = 5 | ^ jshell> BigInteger x = BigInteger("3124342432342324"); | Error: | cannot find symbol | symbol: method BigInteger(java.lang.String) | BigInteger x = BigInteger("3124342432342324"); | ^--------^ jshell> BigInteger x = new BigInteger("3124342432342324"); x ==> 3124342432342324 jshell> x x ==> 3124342432342324 jshell> BigInteger y = new BigInteger("90384904383490"); y ==> 90384904383490 jshell> x*y | Error: | bad operand types for binary operator '*' | first type: java.math.BigInteger | second type: java.math.BigInteger | x*y | ^-^ jshell> x.multiply(y) $6 ==> 282393392008541529255853830760 jshell> x.pow(10) $7 ==> 88631126869299855104793780007653585115362857097112574864076640511194652881901565578307686213456802284759836406586425563884788779628667436509845660684517376 jshell> x.divide(y) $8 ==> 34 jshell> x.add(y) $9 ==> 3214727336725814 jshell> BigInteger foo = new BigInteger(45); | Error: | BigInteger(long) has private access in java.math.BigInteger | BigInteger foo = new BigInteger(45); | ^----------------^ jshell> BigInteger foo = BigInteger.valueOf(45); foo ==> 45 jshell> foo.pow(100) $11 ==> 2095324917039863304313251555826661356467173660585553096278749223514308239748113453774362345525549271530430449123445790860832162183502447305727400816977024078369140625 jshell> foo.pow(1000) $12 ==> 16312246490604323856956690249216982201144975465390654376399331421473782862719380882068723616038594227304647559921414227578875474867657916323216065489181831089455907976047157609862700019242287586610785357254782031223282780001204091254538131605487047386191089668094752059877839836653963749813997920843489460272462556048871539180338677822354672816028208986163480461571302479465076839463911101243694678271063124370482465212648638351914377069383909929774890205995951153650362517492871357176515187631126312710564686204194717183148809225202981139091935963983117553798547781112393108825908121232210780919602431379209917608604278548193719021241708073981765079038186633632 ... 875585949786164700659102225262558722324734919635460819910409960416030501637431531998854534507980526054084082094728446659088572194314038426255574880395967725061482278638012925696085310205093476775353069639000291926132802645479137564031762397619603638090666326711250151413611972413034346911079632003183093047482543624937534332275390625 jshell> BigInteger a = BigInteger.valueOf(10); a ==> 10 jshell> BigInteger b = BigInteger.valueOf(11); b ==> 11 jshell> a < b | Error: | bad operand types for binary operator '<' | first type: java.math.BigInteger | second type: java.math.BigInteger | a < b | ^---^ jshell> a.compareTo(b) $15 ==> -1 jshell> a.compareTo(b) < 0 $16 ==> true jshell> String s = "snake"; s ==> "snake" jshell> String t = "tapir"; t ==> "tapir" jshell> s < t | Error: | bad operand types for binary operator '<' | first type: java.lang.String | second type: java.lang.String | s < t | ^---^ jshell> s.compareTo(t) < 0 $19 ==> true jshell> "a".compareTo("b") $20 ==> -1 jshell> "a".compareTo("z") $21 ==> -25 jshell> "aardvark".compareTo("aardwolf") $22 ==> -1 jshell> BigInteger.TWO.compareTo(BigInteger.TEN) $23 ==> -1 jshell> jshell> BigInteger foo = new BigInteger("9134089803490834198031498034198013498013498043198034190843190831498021349801234980125"); foo ==> 9134089803490834198031498034198013498013498043198 ... 90831498021349801234980125 jshell> BigInteger goo = new BigInteger("3259890329803428903498035289032980325890352980982350890352980352980532890523980325890352980325980903582890235980352980235980235980532980352980239580982350875"); goo ==> 3259890329803428903498035289032980325890352980982 ... 32980352980239580982350875 jshell> foo.gcd(goo) $26 ==> 125 jshell> goo.sqrt() $27 ==> 1805516637919304498674889398914215211766605438258676750849859803570068610355167 jshell> goo goo ==> 3259890329803428903498035289032980325890352980982350890352980352980532890523980325890352980325980903582890235980352980235980235980532980352980239580982350875 jshell>