public byte[] readBinaryFile(String fileName) {

		ByteArrayOutputStream byteStream = new ByteArrayOutputStream();

		byte buffer[] = new byte[1024];

		int read;

		try {
			DataInputStream reader;
			if (mode == APPLET_MODE)
				reader = new DataInputStream(
						FileUtils.class.getResourceAsStream("/" + fileName));
			else
				reader = new DataInputStream(new FileInputStream(fileName));

			while ((read = reader.read(buffer, 0, buffer.length)) >= 0) {
				byteStream.write(buffer, 0, read);
			}

		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return byteStream.toByteArray();
	}