Here you can find the source of alignLength(int sectorSize, long remoteOffset, long len)
public static long alignLength(int sectorSize, long remoteOffset, long len)
//package com.java2s; //License from project: Apache License public class Main { public static long alignLength(int sectorSize, long remoteOffset, long len) { long alignedSize = len + namespaceSectorOffset(sectorSize, remoteOffset); if (namespaceSectorOffset(sectorSize, alignedSize) != 0) { alignedSize += (long) sectorSize - namespaceSectorOffset(sectorSize, alignedSize); }/*from w ww.j a va2s . c om*/ return alignedSize; } public static long namespaceSectorOffset(int sectorSize, long fileOffset) { return fileOffset % (long) sectorSize; } }