<prompt> Matokeo Java code sehemu ambayo inachukua safu ya idadi na anarudi thamani ya kati  <response>: Heres a Java code segment that takes an array of numbers and returns the median value:javapublic static double findMedianint arr double median; int n arr.length; Arrays.sortarr; if n 2 0 median arrn 2 arrn 2 - 1 2.0; else median arrn 2; return median; 