As a bit of speculation, was the assignment by any chance to raise the value to any power, not just squaring? That would explain the multi-threading, as the solution could involve spawning threads to break the problem down by halves. If this is the case, the general solution would involve something like this:
main thread:
get n to square as an int
get expt as an int
Integer result = 0
spawn a pow thread with (n, expt, result) as its arguments
pow thread (n, expt, rsult):
synchronized (result):
if expt is 0:
result += 1
else if expt is 1:
result += n
else if expt is even:
spawn two pow threads (n, (expt / 2))
result = result * result
else:
spawn a pow thread (n, (expt - 1))
result = n * result
This is just a quick sketch; I haven't tried it out. But it should at least give you a place to start.