//*********************************************************************************
// class tig.Integers
// Software released under the General Public License (version 2 or later), available at
// http://www.gnu.org/copyleft/gpl.html
//*********************************************************************************
package tig;

import tig.GeneralConstants;
/**********************************************************************************
Class containing utility static methods for int manipulation.

See also : Class {@link Strings}, which contains conversion methods between Strings and integers. @author Thierry Graff @history feb 04 2002 : Creation. @todo **********************************************************************************/ public abstract class Integers{ //================================================================================= // PUBLIC STATIC METHODS //================================================================================= //***************** contains **************************** /** Indicates if 'value' is contained in 'intArray'. */ public static boolean contains(int[] intArray, int value){ for (int i = 0; i < intArray.length; i++){ if(value == intArray[i]) return true; } return false; }// end contains //*************** copyFrom *************** /** Returns an array of int which is a copy of the array passed in parameter.
There is probably a way to do this with the JDK, but I haven't found it. @param intArray The int[] which is copied. */ public static int[] copyFrom(int[] intArray){ int[] res = new int[intArray.length]; for (int i = 0; i < intArray.length; i++) res[i] = intArray[i]; return res; }// end copyFrom }//end abstract class Integers

Ads help maintain this website.