Force a race condition on the variable `root'.<p><pre><code> if (n.divide(root).equals(root)) {
</code></pre>
Try to set it to 2^20001 on the first funcall and 0 on the second.
I'm not sure this is interesting. Unless I'm missing something, the question is "find what way of breaking the compartmentalization of the JVM we haven't forbidden in these English-language rules".
I'm surprised nobody's given the obvious algorithm yet: while(i < BigInt(2).pow(10000)) ++i;<p>Before anyone complains, this algorithm is correct and does not break any of the rules as far as I can tell. :)<p>I think the timing attack is probably what he's really looking for.<p>Edit: as mattvanhorn pointed out, answer() is void, but that's ok... changed to a "constant time" algorithm. :)
Someone should just modify the StackSort algorithm that was posted yesterday (made up by xkcd) to search for Square Root functions instead and run them.<p><a href="http://gkoberger.github.com/stacksort/" rel="nofollow">http://gkoberger.github.com/stacksort/</a>
Not really a Java guy, but could you subclass BigInteger in such a way that when .divide is called and accesses root's representation of the data, that property access reflectively examines the calling expression to find out n's representation of the data, then just square roots that and sets it as its own representation before allowing the expression to evaluate? Or something along those lines, anyway?
I hate to break it to you but "n" is not final. Hence, you can reassign any BigInteger to it. Why not just set n = 9 and the root = 3...<p>Immutability is your friend. Use it or lose it.
The only possibilities seem to be a timing attack, exploiting a bug or taking advantage of an implementation that puts the dividend value in the exception when dividing by zero.<p>I'm not sure anyone will bother writing the timing attack since he apparently gives out no prize.