留学生代考 COMP1110 Final Exam, Question 1.1

package comp1110.exam;

* COMP1110 Final Exam, Question 1.1
public class Q1Closest {

Copyright By PowCoder代写 加微信 powcoder

* Given an array of integers and a special value target,
* return the value in the array that is numerically closest to
* target. If the array contains two different values equally
* close to target, return the smaller value. If the array is
* empty, return Integer.MAX_VALUE.
* @param in An array of integers
* @param target a target value to search for in the array
* @return the value in the array that is numerically closest to
* target, returning the lesser of equally close values, and
* returning Integer.MAX_VALUE if the array
* has no entries.
public static int findClosest(int[] in, int target) {
// FIXME complete this method

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com