public static KdbTree buildKdbTree(int maxItemsPerNode, List<Rectangle> items)
    {
        checkArgument(maxItemsPerNode > 0, "maxItemsPerNode must be > 0");
        requireNonNull(items, "items is null");
        return new KdbTree(buildKdbTreeNode(maxItemsPerNode, 0, Rectangle.getUniverseRectangle(), items, new LeafIdAllocator()));
    }
@Test
    public void testSerde()
    {
        ImmutableList.Builder<Rectangle> rectangles = ImmutableList.builder();
        for (double x = 0; x < 10; x += 1) {
            for (double y = 0; y < 5; y += 1) {
                rectangles.add(new Rectangle(x, y, x + 0.1, y + 0.2));
            }
        }

        testSerializationRoundtrip(buildKdbTree(100, rectangles.build()));
        testSerializationRoundtrip(buildKdbTree(20, rectangles.build()));
        testSerializationRoundtrip(buildKdbTree(10, rectangles.build()));
    }