Q:

printing wrong decimal

arr[i]=s+t-Math.abs(s-j)/2;

here is the line, s= 600 j = 631 t =60 , the answer should be 645.5 but it prints 645.0. 
arr[] is double 

A:

Assuming that the types of s and j are int, you must be performing Java's integer division, which results in an int.  s-j results in -31, and the Math.abs overload that takes an int is called, and 31 is returned.  Integer division in Java means that 31/2 is 15 the int, not 15.5 the double.
Use the floating-point literal 2.0 to force floating-point division (or cast one of the / operands to a double):
arr[i]=s+t-Math.abs(s-j)/2.0;

