Is there a way to use BigInteger to iterate?

Does it BigIntegerjust equalsfor comparison?
Are there substitutions for mathematical notation like <(more) or <(less than)? ^ Answered!

Now I want to know if there is a way to use BigIntegerin iteration, for example, whileand for?

+3
source share
3 answers

You can use the compareTo method .

+5
source

You cannot use mathematical notation, in fact I would not be used to using == either, I am sure that if they do not use some serious trick, this will not work.

a = new BigInteger(500);

b = a;
if( a == b ) 
    will always be true

b=new BigInteger(500);
if( a == b )
    will never be true

if( a.equals(b) )
    will always work fine.

Java - Java, Complex, , .

, Java , Groovy , . , .

, , Groovy - , .

+1

Java- ; . BigInteger , .

0

Source: https://habr.com/ru/post/1787877/


All Articles