Così è mooooolto più semplice:

codice:
public static String toBinary (int n)
{
    String s = (n & 1) != 0 ? "1" : "0";
    if ((n >>= 1) != 0)
        s = toBinary (n) + s;
    return s;
}
no?