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... Immutability is your friend. Use it or lose it.
Java Puzzle: Square Root
31–40 of 61 posts
Re: Java Puzzle: Square Root
#32I 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... Immutability is your friend. Use it or lose it.
Re: Java Puzzle: Square Root
#33I 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... Immutability is your friend. Use it or lose it.
Re: Java Puzzle: Square Root
#34I'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".
Re: Java Puzzle: Square Root
#35Re: Java Puzzle: Square Root
#36Re: Java Puzzle: Square Root
#37Consider that SecureRandom is really a facade around multiple providers that can plug in varying implementations. :)
Re: Java Puzzle: Square Root
#38I'm surprised nobody's given the obvious algorithm yet: while(i Before anyone complains, this algorithm is correct and does not break any of the rules as far as I can tell. :) I think the timing attack is probably what he's really looking for. Edit: as mattvanhorn pointed out, answer() is void, but that's ok... changed to a "constant time" algorithm. :)
Re: Java Puzzle: Square Root
#39Re: Java Puzzle: Square Root
#40Consider that SecureRandom is really a facade around multiple providers that can plug in varying implementations. :)