Geometry point position

The problem

Given a directed line from point p0(x0, y0) to p1(x1, y1), you can use the following condition to decide whether a point p2(x2, y2) is on the left of the line, on the right, or on the same line. Write a program that prompts the user to enter the three points for p0, p1, and p2 and displays whether p2 is on the left of the line from p0 to p1, to the right, or on the same line.

Breaking it down

public static void main(String[] strings) {

    Scanner input = new Scanner(System.in);

    System.out.print("Enter three points for p0, p1, and p2: ");
    double x0 = input.nextDouble();
    double y0 = input.nextDouble();
    double x1 = input.nextDouble();
    double y1 = input.nextDouble();
    double x2 = input.nextDouble();
    double y2 = input.nextDouble();

    input.close();

    double position = calculatePosition(x0, y0, x1, y1, x2, y2);

    if (position > 0) {
        System.out.println("p2 is on the left side of the line");
    } else if (position == 0) {
        System.out.print("p2 is on the same line");
    } else {
        System.out.println("p2 is on the right side of the line");
    }
}

private static double calculatePosition(double x0, double y0, double x1,
        double y1, double x2, double y2) {
    double position = (x1 - x0) * (y2 - y0) - (x2 - x0) * (y1 - y0);
    return position;
}

Output

Enter three points for p0, p1, and p2: 4.4 2 6.5 9.5 -5 4
p2 is on the left side of the line