Pythagoras triplet

public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long value;
long value1;

	if (n < 3) {
		System.out.println(-1);
	} else if (n % 2 != 0) {
		value = (n * n - 1) / 2;
		value1 = (n * n + 1) / 2;
		System.out.println(value + " " + value1);
	} else {
		value = ((n * n) / 4) - 1;
		value1 = ((n * n )/ 4) + 1;
		System.out.println(value + " " + value1);
	}

}

this code is not running for test case 3 and 4. please help me

Hey @amangaur078 code is fine
just a change long n = sc.nextLong(); instead of int n = sc.nextInt();