Apache Commons Lang 3.0 is a java library with lot of utilities and reusable components. This requires the library commons-lang3-3.0.1.jar to be in classpath. The following example shows creating a MutableInt.
package com.bethecoder.tutorials.commons_lang.tests.numbers; import org.apache.commons.lang3.mutable.MutableInt; public class MutableIntTest { /** * @param args */ public static void main(String[] args) { MutableInt mint = new MutableInt(1234); System.out.println(mint); mint.increment(); System.out.println(mint); mint.decrement(); System.out.println(mint); mint.add(100); System.out.println(mint); mint.subtract(100); System.out.println(mint); } }
1234 1235 1234 1334 1234