The conversation between human and AI assistant.
[|Human|] Output a Java code segment that takes an array of numbers and returns the median value
[|AI|] Here's a Java code segment that takes an array of numbers and returns the median value:

```java
public static double findMedian(int[] arr) {
    double median;
    int n = arr.length;
    Arrays.sort(arr);
        
    if (n % 2 == 0)
        median = (arr[n / 2] + arr[(n / 2) - 1]) / 2.0;
    else
        median = arr[n / 2];
    
    return median;
}
```
[|Human|] 
Output a Java code segment that takes an array of numbers and returns the median value