Reverse of a number

why printing 0123 on java gives other output and how to reverse numbers like that?