Please write in Java and Array List
5 THE SUM X PROBLEM
Return the sum of the extreme (largest and smallest) values inthe int array nums. If there are no values in the array, thenreturn -1.
sumX({9, 5, 1, 3 7}) → 10 // (9 + 1)
sumX({5}) → 10 // (5 + 5)
sumX({}) → -1
6 THE COUNT DIFF PROBLEM
Start with 1 String array wordList and one String word. Yourmethod should calculate and return the number of words that aredifferent from word in the array wordList.
countDiff({“a”, “a”, “b”, “c”}, “a”) → 2 // (b and c)
countDiff({“a”, “a”, “b”, “c”}, “c”) → 3 // (a,
OR
OR