You're almost there. You just need quantifier:
str = str.replaceAll("^0+", "");
It replaces 1 or more occurrences of 0 (that is what +
quantifier is for. Similarly, we have *
quantifier, which means 0 or more), at the beginning of the string (that's given by caret - ^
), with empty string.