Check whether a number can be represented as difference of two squares | Java program to check whether a number can be represented by the difference of two squares ; Function to check whether a number can be represented by the difference of two squares ; Checking if n % 4 = 2 or not ; Driver code
import java . util . * ; class GFG { static boolean difSquare ( int n ) { if ( n % 4 != 2 ) { return true ; } return false ; } public static void main ( String [ ] args ) { int n = 45 ; if ( difSquare ( n ) ) { System . out . print ( "YesNEW_LINE"); } else { System . out . print ( "NoNEW_LINE"); } } }