CN PROGRAMS PART-B
CN PROGRAMS PART-B
// Setup input and output streams for communication with the client
BufferedReader in = new BufferedReader(new
InputStreamReader(clientSocket.getInputStream()));
PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);
class parity
{
/* Function to get parity of number n.
It returns 1 if n has odd parity, and
returns 0 if n has even parity */
static boolean getParity(int n)
{
boolean parity = false;
while(n != 0)
{
parity = !parity;
n = n & (n-1);
}
return parity;