appending an existed array
<p>I have some question about arrays, I'm reading some book about Java, and now I was reading about class StringBuilder, I was taught that this class saves my string in array with current capacity, in the case that the capacity is not sufficient, this class automatically increases capacity <code>capacity = 2*(capacity + 1)</code>, when I was studying c and c++, I was taught to do the same things if I don't have enough space in my array, but <code>what is the logic behind this statement?</code> why can't I just find out how much memory do I need and then to do <code>capacity = capacity + homMuchDoINeed()</code>, or why not <code>capacity = 4 * capacity</code>, thanks in advance for the answers</p>
