Math.pow returns a double, so you add +1 to the double value and then add it to int, short or byte. But this part is already covered in other answers.
There is another interesting thing in your example. Differences between casting with double and decimal types.
You have differences in bracketing. And -sing instead +on the line short.
Fixed them for you (always discard at the end):
System.out.println((byte) (Math.pow(2, 7)+1));
System.out.println((short) (Math.pow(2, 15)+1));
System.out.println((int) Math.pow(2, 31));
System.out.println((int) (Math.pow(2, 31)+1));
System.out.println((int) (Math.pow(2, 31)+100));
:
-127
-32767
2147483647
2147483647
2147483647
, int overflows. .
http://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html - :
The results for char, int, and long are unsurprising, producing the minimum and maximum representable values of the type.
The results for byte and short lose information about the sign and magnitude of the numeric values and also lose precision. The results can be understood by examining the low order bits of the minimum and maximum int. The minimum int is, in hexadecimal, 0x80000000, and the maximum int is 0x7fffffff. This explains the short results, which are the low 16 bits of these values, namely, 0x0000 and 0xffff; it explains the char results, which also are the low 16 bits of these values, namely, '\u0000' and '\uffff'; and it explains the byte results, which are the low 8 bits of these values, namely, 0x00 and 0xff.
: +1 . (byte) (0b10000000) -128, .