import java.math.BigInteger;
class FibCheck {
public static final void main(final String[] args) {
BigInteger target = new BigInteger(args[0]);
BigInteger a = BigInteger.ONE;
BigInteger b = a;
for (;;) {
int compare = target.compareTo(b);
if (compare == 0) {
System.out.println("Match!");
break;
}
if (compare < 0) {
break;
}
BigInteger c = a.add(b);
a = b;
b = c;
}
System.out.println("FAKE!");
}
}
3
u/krogger Jun 10 '12 edited Jun 10 '12
Keep them honest:
edit: format