Monthly Archives: December 2013

Convert integer array to integer

This is a simple function on how one can convert an integer array (int[]) to integer value

</pre>
public int add(int[] array) {
int len = array.length;
int tmp = 0;
for(int i: array){
tmp += i*((int)Math.pow(10,--len));
}

return tmp;
}
<pre>
Advertisements

Exception java.util.ConcurrentModificationException on ArrayList

If you encounter exception:

Exception in thread “main” java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
at java.util.AbstractList$Itr.next(AbstractList.java:343)

You can go around and use CopyOnWriteArrayList<E>() instead.