Implementing my own Integer.toBinaryString(int n) method
The exercise calls for bit shifting. Only bit shifting, nothing else, really. Your main tools are:

checking if the last bit is 0 or 1 with: num &amp; 1
then shift by one bit to the right: num &gt;&gt; 1

A naive implementation could go like this:
    String result = &quot;&quot;;
    while (num &gt; 0) {
        result = (num &amp; 1) + result;
        num &gt;&gt;= 1;
    }
    return result;

But that won't work for negative numbers. A simple tweak can fix that:
    String result = &quot;&quot;;
    while (num != 0) {
        result = (num &amp; 1) + result;
        num &gt;&gt;&gt;= 1;
    }
    return result;

Instead of the signed bit shift operator &gt;&gt;, we need to use the unsigned bit shift operator &gt;&gt;&gt;, to shift the negative bit just like all the others. And we changed the condition to != 0 instead of &gt; 0.
But this won't work for 0. But only for 0. So you can add a simple condition to handle that.
Lastly, string concatenation is inefficient. We can do better using a StringBuilder.
But a StringBuilder only has an append method, doesn't have prepend. It has an insert method, but that won't be efficient.
A simple solution is to append the bits and reverse at the end.
String toBinaryString(int num) {
    if (num == 0) {
        return &quot;0&quot;;
    }

    StringBuilder builder = new StringBuilder(32);
    while (num != 0) {
        builder.append(num &amp; 1);
        num &gt;&gt;&gt;= 1;
    }
    return builder.reverse().toString();
}

In any case, the StringBuilder is not a critical piece here.
You could use a char[] with 32 elements to store the digits,
and transform that to a string to return.