package com.codegym.task.task21.task2101;
/*
Determine the network address
*/
public class Solution {
public static void main(String[] args) {
byte[] ip = new byte[]{(byte) 192, (byte) 168, 1, 2};
byte[] mask = new byte[]{(byte) 255, (byte) 255, (byte) 254, 0};
byte[] netAddress = getNetAddress(ip, mask);
print(ip); //11000000 10101000 00000001 00000010
print(mask); //11111111 11111111 11111110 00000000
print(netAddress); //11000000 10101000 00000000 00000000
}
public static byte[] getNetAddress(byte[] ip, byte[] mask) {
return new byte[4];
}
public static void print(byte[] bytes) {
}
}
Please Help
Under discussion
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Wojtek
26 April 2019, 10:37
In getNetAddress method you have to compare byte ip and byte mask :
Print method i tried to solve but i failed to +1
Denis
4 June 2019, 01:36
I have the same it works, I passed verification.
Print method:
+4