code: public void compress(String path)
  	{
  		try {
  
  			File fileToArchive = new File(path);
  
  			BufferedInputStream input = new BufferedInputStream(new FileInputStream(fileToArchive));
  
  			File archivedFile = new File(fileToArchive.getName() + ".bz2");
  			archivedFile.createNewFile();
  
  			FileOutputStream fos = new FileOutputStream(archivedFile);
  			BufferedOutputStream bufStr = new BufferedOutputStream(fos);
  			// added bzip2 prefix
  			fos.write("BZ".getBytes());
  			CBZip2OutputStream bzip2 = new CBZip2OutputStream(bufStr);
  
  			while (input.available() > 0) {
  				int size = COMPRESSION_CACHE;
  
  				if (input.available() < COMPRESSION_CACHE) {
  					size = input.available();
  				}
  				byte[] bytes = new byte[size];
  
  				input.read(bytes);
  
  				bzip2.write(bytes);
  			}
  			bzip2.close();
  			bufStr.close();
  			fos.close();
  			input.close();
  
  		}
  		catch (IOException e) {
  			e.printStackTrace();
  		}
  
  	}
docs: Creates bz2 archive file from file in path
  
  @param path
  to file to compress