Improving the previous example..

.. to work with Files for real!
import java.io.*;
import java.util.Scanner;
 
public class Main {
 
    private static byte[] checkBytes = new byte[8];
 
    static {
        checkBytes[0] = ((byte) -128); // 1000_0000
        checkBytes[1] = ((byte) 64); // 0100_0000
        checkBytes[2] = ((byte) 32); // 0010_0000
        checkBytes[3] = ((byte) 16); // 0001_0000
        checkBytes[4] = ((byte) 8);
        checkBytes[5] = ((byte) 4);
        checkBytes[6] = ((byte) 2);
        checkBytes[7] = ((byte) 1);
    }
 
    private static final String inputFileName = "bytes.txt";
    private static final String temporaryFile01Filename = "01_temp.txt";
    private static final String temporaryFile02Filename = "02_temp.txt";
    private static final String temporaryFile03Filename = "03_temp.txt";
 
    private static final File inputFile = new File(inputFileName);
    private static final File temporaryFile01 = new File(temporaryFile01Filename);
    private static final File temporaryFile02 = new File(temporaryFile02Filename);
    private static final File temporaryFile03 = new File(temporaryFile03Filename);
 
    private static File smallerFile;
 
    public static void main(String[] args) throws IOException {
        final StringBuilder stringBuilder = new StringBuilder();
 
        String fewerElementsIn = segregateBytesAgainstACheckByte(checkBytes[0], inputFile);
        stringBuilder.append(fewerElementsIn);
 
        for (int i = 1; i < 8; i++) {
            makeCopyOfSmallerTempFile();
            fewerElementsIn = segregateBytesAgainstACheckByte(checkBytes[i], temporaryFile03);
            stringBuilder.append(fewerElementsIn);
        }
 
        System.out.println(stringBuilder);
    }
 
    private static String segregateBytesAgainstACheckByte(final byte byteToCheckAgainst,
                                                          final File file) throws IOException {
        final Scanner scanner = new Scanner(file);
 
        final BufferedWriter temp_01_writer = new BufferedWriter(new PrintWriter(temporaryFile01));
        final BufferedWriter temp_02_writer = new BufferedWriter(new PrintWriter(temporaryFile02));
 
        int temp_01_counter = 0;
        int temp_02_counter = 0;
 
        while (scanner.hasNextInt()) {
            final byte b = (byte) scanner.nextInt();
            if ((byteToCheckAgainst & b) == 0) {
                temp_01_counter++;
                temp_01_writer.write(String.valueOf(b));
                temp_01_writer.newLine();
                temp_01_writer.flush();
            } else {
                temp_02_counter++;
                temp_02_writer.write(String.valueOf(b));
                temp_02_writer.newLine();
                temp_02_writer.flush();
            }
        }
 
        temp_01_writer.close();
        temp_02_writer.close();
 
        scanner.close();
 
        String valToReturn;
        if (temp_01_counter <= temp_02_counter) {
            valToReturn = "0";
            smallerFile = temporaryFile01;
        } else {
            valToReturn = "1";
            smallerFile = temporaryFile02;
        }
 
        return valToReturn;
    }
 
    private static void makeCopyOfSmallerTempFile() throws IOException {
        final File fileToBeCopied = smallerFile;
 
        final FileReader fileReader = new FileReader(fileToBeCopied);
        final FileWriter fileWriter = new FileWriter(temporaryFile03);
        int readVal;
        while ((readVal = fileReader.read()) != -1) {
            fileWriter.write(readVal);
        }
 
        fileReader.close();
        fileWriter.flush();
        fileWriter.close();
    }
}