The problem is with Math.pow(2,63). The Math.pow returns a double when the cast occurs maybe you can lose some information.
If you want that ‘if’ will work, if( x >= -1 * (long) Math.pow(2,63) && x<=(long) Math.pow(2,63) -1 ) System.out.println("* long");
You need to add a bracket, like x<=(long) ( Math.pow(2,63)-1 )
if(x>=-1*(long)Math.pow(2,63) && x<=(long) ( Math.pow(2,63)-1 ) )System.out.println("* long");
Want to learn Java? Check out the Java certification from Intellipaat.