I completed a task: The objective was to create a method with 2 arguments: a number to count to, and how many char/numbers in the resulting string.

Result: Let's say that "number" is 5, so it will count: 01234543210 BUT it will also add spaces to the sides to complete the 2nd requirement "lenght", so if long is 15, the result would be " 01234543210 " with 2 spaces to each side (always same quantity of space each side) So i wrote this piece of code, but other coder told me that he used half the lines I did.

There were many assumptions in the code, like the fact that lenght is > than number or that if number is an odd number, lenght is odd too.

So my question would be, can this code be reduced (refactored?) (I just have one month of experience in Java, so be hard but understanding.)

```
public static void counter(int number, int lenght) {
    int numberFull=(number*2)+1;
    int spaceFull=lenght-numberFull;
    int space=spaceFull/2;
    for (int a=1;a<=space;++a)
        {System.out.print(" ");}
    for (int x=0;x<=number;x++)
        {System.out.print(x);}
    for (int y=number-1;y>=0;y--)
        {System.out.print(y);}
    for (int b=1;b<=space;++b)
        {System.out.print(" ");}
}

```