I have given number and want it to return as a String in expanded form. For example

```
expandedForm(12); # Should return "10 + 2"
expandedForm(42); # Should return "40 + 2"
expandedForm(70304); # Should return "70000 + 300 + 4"

```

My function works for first and second case, but with 70304 it gives this: 

```
70 + 00 + 300 + 000 + 4

```

Here's my code

```
import java.util.Arrays;

public static String expandedForm(int num)
{

  String[] str = Integer.toString(num).split("");
  String result = "";

  for(int i = 0; i < str.length-1; i++) {
    if(Integer.valueOf(str[i]) > 0) {
      for(int j = i; j < str.length-1; j++) {
        str[j] += '0';
      }
    }
  }

  result = Arrays.toString(str);
  result = result.substring(1, result.length()-1).replace(",", " +");
  System.out.println(result);

  return result;
}

```

I think there's a problem with the second loop, but can't figure out why.