Source Code : Appends an integer to an integer array.
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Appends an integer to an integer array.
import java.lang.reflect.Array;
/*********************************************************************
* Array manipulation for Java 1.1+.
*
* <p>
* Java 1.1 compatible.
* </p>
*
* @see
* ArrayLib2
*
* @version
* 2003-04-07
* @since
* 2001-04-06
* @author
* <a href="http://croftsoft.com/">David Wallace Croft</a>*/
public class Util{
/*********************************************************************
* Appends an integer to an integer array.
*
* @param intArray
*
* May be null.
*********************************************************************/
public static int [ ] append ( int [ ] intArray, int i )
//////////////////////////////////////////////////////////////////////
{
if ( intArray == null )
{
return new int [ ] { i };
}
int intArrayLength = intArray.length;
int [ ] newIntArray = new int [ intArrayLength + 1 ];
System.arraycopy ( intArray, 0, newIntArray, 0, intArrayLength );
newIntArray [ intArrayLength ] = i;
return newIntArray;
}
}
Thank with us