```
public int[] plusOne(final int[] digits) {
int[] result = new int[digits.length + 1];
int carry = 1;
for (int i = digits.length - 1; i >= 0; i--) {
int sum = digits[i] + carry;
result[i + 1] = sum % 10;
carry = sum / 10;
}
result[0] = carry;
return result[0] != 0 ? result : Arrays.copyOfRange(result, 1, result.length);
}
```