Line sweep

can anyone provide me good implementation of number of line segment intersections using sweep line algorithm so that it can be helpful to unserstand more clearly