public static void main(String[] args) throws FileNotFoundException {

		// generate dictionary
		String path = "test.txt";

		ProtozoonFileReaderImpl reader = new ProtozoonFileReaderImpl(path);
		ProtozoonFileWriterImpl writer = new ProtozoonFileWriterImpl(path
				.substring(0, path.length() - ".zoon".length()));

		HashMap<Byte, Integer> bmap = new HashMap<Byte, Integer>();

		while (!reader.isEndOfFile()) {

			byte[] data = reader.readBytes(Constants.getUsableMemoryBytes());

			if (data.length > 0) {

				for (int i = 0; i < data.length; i++) {

					if (bmap.containsKey(data[i])) {

						bmap.put(data[i], bmap.get(data[i]) + 1);

					} else {

						bmap.put(data[i], 1);

					}

				}

			}

		}

		reader.close();
		writer.close();

		Object[][] arr = new Object[bmap.keySet().size()][2];

		int z = 0;

		for (Entry<Byte, Integer> entry : bmap.entrySet()) {

			arr[z][0] = entry.getKey();
			arr[z][1] = entry.getValue();

			z++;

		}

		for (int i = 0; i < arr.length; i++) {

			for (int j = 0; j < arr.length; j++) {

				Object[] temp;

				if ((Integer) arr[i][1] > (Integer) arr[j][1]) {

					temp = arr[j];
					arr[j] = arr[i];
					arr[i] = temp;

				}

			}

		}

		// ordered 2 dimensional array with the bytes and the count
		for (int i = 0; i < arr.length; i++) {
			System.out.println(arr[i][0] + ":" + arr[i][1]);
		}

	}