Java Byte Array Convert To bytesToBlocks(final long bytes, final int blockSize)

Here you can find the source of bytesToBlocks(final long bytes, final int blockSize)

Description

bytes To Blocks

License

Apache License

Declaration

public static int bytesToBlocks(final long bytes, final int blockSize) 

Method Source Code

//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);
        }
    }
}

Related

  1. bytes_to_sbuf(byte[] data, int offset, int length, StringBuffer buf)
  2. bytes_to_short(byte[] buf, int offset)
  3. bytes_to_str(byte[] data)
  4. bytesToAlphaNumeric(byte[] number)
  5. bytesToAsciiMaybe(byte[] data)
  6. bytesToBool(byte[] data, int[] offset)
  7. bytesToBoxingBytes(final byte[] bytes)
  8. BytesTobytes(Byte[] bytes)
  9. bytesToChars(byte[] bytes)