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; /* w w w . j ava2 s . c om*/ public final class PoolFloat { private final float[][] pool; private int poolSize; public PoolFloat(final int maxPoolSize) { pool = new float[maxPoolSize][]; } public final float[] getArray(final int size) { for (int i = 0; i < poolSize; i++) { if (pool[i].length == size) { final float[] toReturn = pool[i]; pool[i] = pool[poolSize - 1]; poolSize--; return toReturn; } } final float[] toReturn = new float[size]; return toReturn; } public final void returnArray(final float[] array) { if (array != null) { pool[poolSize++] = array; } } }