Please create a method with given signature:
public int reverse(int x)
result: Please return int with reversed digits
requirements:
- You can use only int numeric type (boolean and other types are allowed)
- When
result > MAX_INTEGERorresult < MIN_INTEGERplease return 0
Examples:
| x | result |
|---|---|
| 12345 | 54321 |
| -123 | -321 |
| 0 | 0 |
Allowed types (examples):
| you can use | you can't use |
|---|---|
| String | Long |
| Boolean | BigDecimal |
| Integer | ... |
| ... | ... |