// Formula for expanding a large random access file when it runs out of space. // presume DaysBetweenDefrags = 7 if you have no better information. long newSize = currentSize + expectedGrowthPerDay * DaysBetweenDefrags; // If you have no estimate for expected growth, use this formula // to grow it by 10%, rounded up, whenever it runs out of space. // The file may be initially become very fragmented but should // settle down after the first defrag. long newSize = (currentSize * 110 + 99) / 100;