///
Considere o código-fonte a seguir:
import java.util.Scanner;
public class T16 {
static int a[] = {1, 6, 9, 10, 12, 18, 21, 34};
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Digite um valor:");
int v = in.nextInt();
int r = service(v);
if (r == -1) {
System.out.println("Sem êxito");
} else {
System.out.print(r + " -> " + v);
}
}
public static int service(int valor) {
int l = 0;
int h = a.length - 1;
while (l <= h) {
int m = (l + h) / 2;
int d = a[m] - valor;
if (d == 0) {
return m;
} else if (d < 0) {
l = m + 1;
} else {
h = m - 1;
}
}
return -1;
}
}É correto afirmar que a classe Java apresentada implementa uma