Back to project page CircleWorldGDX.
The source code is released under:
MIT License
If you think the Android project CircleWorldGDX listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.fdangelo.circleworld.universeengine.utils; //ww w . ja va 2 s . com public final class PoolByte { private final byte[][] pool; private int poolSize; public PoolByte(final int maxPoolSize) { pool = new byte[maxPoolSize][]; } public final byte[] getArray(final int size) { for (int i = 0; i < poolSize; i++) { if (pool[i].length == size) { final byte[] toReturn = pool[i]; pool[i] = pool[poolSize - 1]; poolSize--; return toReturn; } } final byte[] toReturn = new byte[size]; return toReturn; } public final void returnArray(final byte[] array) { if (array != null) { pool[poolSize++] = array; } } }