Root Finder for polynomials

Hey guys, i've been working on a program that finds the roots of a complex function in Pre-Calculus (x^3 + 2x^2 - 4x + 1 or something like that), and i'm not doing this to help me with my math, i just enjoy making programs that are useful in math and physics. Now, i've already made a class that does Synthetic Division for you, after putting in the root and all of the coefficients of the original function, and it returns the resulting function, and tells you whether or not the root you tested is a root of the function. This class works great, as seen through my tester class where the user enters the coefficients and the root they want to test.

So here's the problem. This isn't as efficient as i would like it to be. i want to make it so that the user doesn't have to enter in the possible root, it automatically finds the possible roots (when you do constant coefficient over leading coefficient, and you take the factors). So with all of this said, my problem is that i'm trying to figure out a way to get all of the possible roots.

MY IDEA FOR THIS: divide the number (leading and constant) by all of the numbers less than that number.

I hope this isn't too wordy or confusing, so let me give you an example.

x^3 + 3x^2 + 2x + 2

Finding the possible roots:

2/1 ( 1 , 2 )/ 1

So, the possible roots are -1, -2, 1, 2. (because you take the positive and the negative of each division).

So like i said, my idea is to test if the number divided by each individual number less than it is an int. (because if it were a decimal number, it is not a factor) .

Would it be possible to test if the resulting number is instanceof Integer?

Any help would be appreciated, and i'm sorry if explained it terribly =]