public static String humanReadableBytes(long bytes, boolean si)
	{
		// This algorithm doesn't like negatives
		boolean positive = true;
		if(bytes < 0)
		{
			bytes = -bytes;
			positive = false;
		}

		// Figure out if we're using powers of 2 (non-SI) or 10 (SI)
		int unit = si ? 1000 : 1024;
		if(bytes < unit)
		{
			if(positive)
			{
				return bytes + " B";
			}
			else
			{
				return "-" + bytes + " B";
			}
		}

		// Figure out the unit being used
		int exp = (int) (Math.log(bytes) / Math.log(unit));
		String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp - 1) + (si ? "" : "i");

		// Return as a formatted string
		String result = String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre);

		if(!positive)
		{
			result = "-" + result;
		}
		return result;
	}