Pythagoras triplet - not getting the desired output what is wrong in it?

import java.util.*;
import java.lang.Math;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int X, Y;
if(N%2==0)
{
X = ((N^2)/4)-1;
Y = ((N^2)/4)+1;
System.out.println(X+" “+Y);
}
else if(N%2==1)
{
X = ((N^2)-1)/2;
Y = ((N^2)+1)/2;
System.out.println(X+” “+Y);
}
else{
System.out.println(”-1");
}
}
}

why have u printed n+1 and n+2??
Pythagoras triplets are not always consecutive
consider 6 8 10
correct your formula