Here you can find the source of bytesToBlocks(final long bytes, final int blockSize)
public static int bytesToBlocks(final long bytes, final int blockSize)
//package com.java2s; //License from project: Apache License public class Main { public static int bytesToBlocks(final long bytes, final int blockSize) { if (bytes % blockSize == 0) { return (int) ((double) bytes / (double) blockSize); } else {//from w w w . j a v a2 s .com return (int) (((double) bytes / (double) blockSize) + 1.0); } } }