Here you can find the source of getDockInsets(final TreeSet
private static int getDockInsets(final TreeSet<Integer> set)
//package com.java2s; import java.util.TreeSet; public class Main { /**//from w ww . jav a 2 s .c o m * This is the maximum grid position for "normal" components. Docking components use the space out to * <code>MAX_DOCK_GRID</code> and below 0. */ private static final int MAX_GRID = 30000; private static int getDockInsets(final TreeSet<Integer> set) { int c = 0; for (final Integer i : set) { if (i < -MAX_GRID) { c++; } else { break; // Since they are sorted we can break } } return c; } }