Java program to get the flooring item of specified value from TreeSet collection
// Java program to get the flooring item of specified value
// from the TreeSet collection
import java.io.*;
import java.util.*;
public class Main {
public static void main(String args[]) {
TreeSet < Integer > tree = new TreeSet < Integer > ();
tree.add(10);
tree.add(20);
tree.add(25);
tree.add(30);
int value = tree.floor(22);
System.out.println("Flooring value for 22: " + value);
}
}
Output
Flooring value for 22: 20