Integer[] ia = (Integer[]) dup.toArray( new Integer[0] ); int[] pia = new int[ia.length];
int[] pia = new int[dup.size( )];
	private static int[] getDuplicateIndices( int[] a1, int[] a2 )	{		if ( a1 == null || a2 == null || a1.length == 0 || a2.length == 0 )		{			return null;		}		// sort first.		Arrays.sort( a1 );		Arrays.sort( a2 );		if ( a1[a1.length - 1] < a2[0] || a1[0] > a2[a2.length - 1] )		{			return null;		}		// swap to keep a1 have the min length.		if ( a1.length > a2.length )		{			int[] tmp = a1;			a1 = a2;			a2 = tmp;		}		List dup = new ArrayList( );		// check duplicate		for ( int i = 0; i < a1.length; i++ )		{			if ( Arrays.binarySearch( a2, a1[i] ) >= 0 )			{				dup.add( new Integer( a1[i] ) );			}		}		if ( dup.size( ) == 0 )		{			return null;		}		else		{			Integer[] ia = (Integer[]) dup.toArray( new Integer[0] );			int[] pia = new int[ia.length];			for ( int i = 0; i < ia.length; i++ )			{				pia[i] = ia[i].intValue( );			}			return pia;		}	}