current position:Home>Design a mathutils Java class file

Design a mathutils Java class file

2022-02-02 12:42:38 CSDN Q & A

To design a MathUtils.java Class file
(1) Design static functions to maximize getMax Pass in 1 individual int Array type parameter , return int Type data such as [12345] return 5 (10 branch )




Refer to the answer 1:

(2) Design static function to find the minimum value getMin , Pass in 1 individual int Array type parameter , return int Type data , Such as [1,2,3,4,5] return 1 (10 branch )
(3) Design static function inversion reverse, Pass in 1 individual int Array type parameter , Invert the data in the array and return the array to , Such as [1,2,3,4,5] , return [5,4,3,2,1] (10 branch )
(4) Design static functions getIndex Find the subscript position corresponding to the data in the current array , Pass in 1 individual int Array type parameters and int Type data , Return the index of the data in the array to , Such as , stay [11,22,33,44,55] lookup 55 , return Subscript 4. (10 branch )
(5) Design static functions to exchange the contents of the array swap, Pass in 1 individual int Array type parameter , No return value , Such as incoming [88,99] , call swap The contents of the last array are [99,88] (10 branch )
(6) Design static function to count the sum of data in the array getSum, Pass in 1 individual int Array type parameter , Returns the sum of the data in the array , Such as [1,2,3,4,5] return 15 (10 branch )
(7) Design static function to count the average value of data in the array getAvg, Pass in 1 individual int Array type parameter , Returns the average value of the data in the array , Such as [1,2,3,4,5] return 3 (10 branch )
(8) Extended function realization : Design static function sorting sort Method , Pass in 1 individual int Array type parameter , No return value Such as [ 10,2,8,5,7] , call sort after [2,5,7,8,10] (20 branch )
(9) Call each function test to view the output results (10 branch )




Refer to the answer 2:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202021242353528.html

Random recommended