package domZadanie; import java.io.FileInputStream; import java.io.File; import java.io.IOException; import java.io.PrintWriter; public class DomZadanie { public static void main(String[] args) throws IOException { FileInputStream myfile = new FileInputStream("C:/Users/User/Desktop/const256.txt"); byte[]b=new byte[256]; int f=0, c=0; myfile.read(b); for(int k=0;k<b.length;k++){ while(b[k]!=0){ if(b[k]%2==1){f++;} b[k]=(byte)(b[k]/2); } } System.out.println(f); } }