Java Datatypes

  • + 1 comment

    if(x >= -Math.pow(2, 63) && x <= Math.pow(2, 63) - 1) this particular condition checking isnt required at all.

    According to problem statement the long data type can fit in all possibe input except when it doesnt. So the initialization and assignment part

    long x=sc.nextLong(); along with the try and catch exception checking and handling blocks take care of that.