You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
446 B
Java
16 lines
446 B
Java
5 years ago
|
import java.util.Collections;
|
||
|
import java.util.Vector;
|
||
|
public class Main {
|
||
|
public static void main(String[] args) {
|
||
|
Vector v = new Vector();
|
||
|
v.add("X");
|
||
|
v.add("M");
|
||
|
v.add("D");
|
||
|
v.add("A");
|
||
|
v.add("O");
|
||
|
Collections.sort(v);
|
||
|
System.out.println(v);
|
||
|
int index = Collections.binarySearch(v, "D");
|
||
|
System.out.println("Element found at : " + index);
|
||
|
}
|
||
|
}
|