@@ -0,0 +1,1009 @@
+package com.javarush.task.task21.task2101;%0A%0A/* %0A%D0%9E%D0%BF%D1%80%D0%B5%D0%B4%D0%B5%D0%BB%D1%8F%D0%B5%D0%BC %D0%B0%D0%B4%D1%80%D0%B5%D1%81 %D1%81%D0%B5%D1%82%D0%B8%0A*/%0Apublic class Solution %7B%0A    public static void main(String%5B%5D args) %7B%0A        byte%5B%5D ip = new byte%5B%5D%7B(byte) 192, (byte) 168, 1, 2%7D;%0A        byte%5B%5D mask = new byte%5B%5D%7B(byte) 255, (byte) 255, (byte) 254, 0%7D;%0A        byte%5B%5D netAddress = getNetAddress(ip, mask);%0A        print(ip);          //11000000 10101000 00000001 00000010%0A        print(mask);        //11111111 11111111 11111110 00000000%0A        print(netAddress);  //11000000 10101000 00000000 00000000%0A    %7D%0A%0A    public static byte%5B%5D getNetAddress(byte%5B%5D ip, byte%5B%5D mask) %7B%0A        byte%5B%5D res = new byte%5B4%5D;%0A%0A        for (int i = 0; i %3C 4; i++) %7B%0A            res%5Bi%5D = (byte) (ip%5Bi%5D & mask%5Bi%5D);%0A        %7D%0A%0A        return res;%0A    %7D%0A%0A    public static void print(byte%5B%5D bytes) %7B%0A        for (byte b : bytes) %7B%0A            //Byte to binary format%0A            System.out.print(Integer.toBinaryString((b & 0xFF) + 0x100).substring(1)+%22 %22);%0A        %7D%0A        System.out.println();%0A    %7D%0A%7D%0A

Task --> 2101