public static void main(String args[]){
        FourPointsFormSquare fpf = new FourPointsFormSquare();
        Cordinate c1 = new Cordinate();
        c1.x = 2;
        c1.y = 2;
        Cordinate c2 = new Cordinate();
        c2.x = 6;
        c2.y = 2;
        Cordinate c3 = new Cordinate();
        c3.x = 2;
        c3.y = -2;
        Cordinate c4 = new Cordinate();
        c4.x = 6;
        c4.y = -2;
        Cordinate[] c = new Cordinate[4];
        c[0] = c1;
        c[1] = c2;
        c[2] = c3;
        c[3] = c4;
        System.out.println(fpf.isSquare(c));
    }
Given four points in any order determine if they form a square
Test cases
Less than or more than 4 points in input
Points could be in any quadrants e.it neg and pos allowed
src/com/interview/misc/FourPointsFormSquare.java