public static void TypeStatistics(String directoryPath) {
        File directory = new File(directoryPath);
        File[] files = directory.listFiles();
        long[] typeCounts = new long[32];
        for (int i = 0; i < typeCounts.length; i++) {
            typeCounts[i] = 0;
        }
        System.out.println("Reading input from " + directoryPath);
        for (File inputFile : files) {
            if (inputFile.getName().endsWith(".txt")) {
                System.out.println("  Processing " + inputFile.getName());
                try {
                    KineticLogFileReader reader = new KineticLogFileReader(inputFile.getAbsolutePath());
                    KineticResponse kineticResponse = reader.read();
                    while (kineticResponse != null) {
                        if (kineticResponse instanceof ModeSAdsbData) {
                            ModeSAdsbData modeSAdsbData = (ModeSAdsbData) kineticResponse;
                            int[] data = modeSAdsbData.getModeSData();
                            int typeCode = extractInt(data, 32 + 0, 5);
                            typeCounts[typeCode]++;
                        }
                        kineticResponse = reader.read();
                    }
                    reader.close();
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

        try {
            PrintWriter pw = new PrintWriter("E:\\adsb\\df17-kmto.txt");
            pw.println("Type\tCount");
            for (int i = 0; i < typeCounts.length; i++) {
                pw.println(i + "\t" + typeCounts[i]);
            }
            pw.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }

    }