Example usage for org.apache.commons.lang ArrayUtils toObject

List of usage examples for org.apache.commons.lang ArrayUtils toObject

Introduction

In this page you can find the example usage for org.apache.commons.lang ArrayUtils toObject.

Prototype

public static Boolean[] toObject(boolean[] array) 

Source Link

Document

Converts an array of primitive booleans to objects.

Usage

From source file:com.intel.daal.spark.rdd.DistributedNumericTable.java

/**
 * Flattens a DistributedNumericTable backed by HomogenNumericTables into a JavaDoubleRDD.
 * @param distNT - The source DistributedNumericTable.
 *//*from ww  w  . j  a v  a2 s.  co m*/
public static JavaDoubleRDD toJavaDoubleRDD(final DistributedNumericTable distNT) {
    JavaDoubleRDD rdd = distNT.numTables.flatMapToDouble(new DoubleFlatMapFunction<NumericTableWithIndex>() {
        public List<Double> call(NumericTableWithIndex nt) {
            DaalContext context = new DaalContext();
            NumericTable table = nt.getTable(context);
            if (table instanceof HomogenNumericTable) {
                double[] array = ((HomogenNumericTable) table).getDoubleArray();
                context.dispose();
                return Arrays.asList(ArrayUtils.toObject(array));
            } else {
                context.dispose();
                return null;
            }
        }
    });
    return rdd;
}

From source file:ch.epfl.data.squall.operators.TwitterParserOperator.java

@Override
public TwitterParserOperator setGroupByColumns(int... hashIndexes) {
    return setGroupByColumns(Arrays.asList(ArrayUtils.toObject(hashIndexes)));
}

From source file:models.TopicModel.java

public List recommend(JsonNode jsonData, int maxTopics, int maxRecommendations)
        throws ClassNotFoundException, IOException, InterruptedException {
    PancakeTopicInferencer inferencer = malletTopicModel.getInferencer();
    InstanceList inferenceVectors = getInferenceVectors(jsonData);

    Configuration config = Play.application().configuration();

    List<List> distributions = inferencer.inferDistributions(inferenceVectors,
            config.getInt("smarts.inference.numIterations"), config.getInt("smarts.inference.thinning"),
            config.getInt("smarts.inference.burnInPeriod"),
            Double.parseDouble(config.getString("smarts.inference.threshold")));

    List<List> inferenceOrderedDistribution = inferencer.inferSortedDistributions(inferenceVectors,
            config.getInt("smarts.inference.numIterations"), config.getInt("smarts.inference.thinning"),
            config.getInt("smarts.inference.burnInPeriod"),
            Double.parseDouble(config.getString("smarts.inference.threshold")),
            Math.max(maxTopics, config.getInt("smarts.inference.numSignificantFeatures")));

    // output containers
    List output = new ArrayList(2);
    List<String> inferredWords = new ArrayList<String>();
    List<String> distributionDesc = new ArrayList<String>();
    List<String> recommendations = new ArrayList<String>();
    Set<String> allRecommendations = new HashSet<String>();

    // for each document
    for (int distIndex = 0; distIndex < inferenceOrderedDistribution.size(); distIndex++) {
        List docTopTopics = inferenceOrderedDistribution.get(distIndex);
        List<List> topicDist = (List<List>) docTopTopics.get(1);

        // obtain textual topic distribution info
        List<String> docTopicWords = new ArrayList<String>();
        List<String> docTopicWeightDesc = new ArrayList<String>();
        for (int topicIndex = 0; topicIndex < maxTopics; topicIndex++) {
            // obtain textual topic distribution info
            List topicData = topicDist.get(topicIndex);
            int topicNumber = ((Integer) topicData.get(0)).intValue();
            double topicWeight = ((Double) topicData.get(1)).doubleValue();

            Topic topic = topics.get(topicNumber);
            docTopicWords.add(topic.getWordSample());
            docTopicWeightDesc.add(String.format("topic #%d match: %.2f%%", topicNumber, topicWeight));
        }//from w  w w .  java 2 s.co  m
        inferredWords = docTopicWords;
        distributionDesc = docTopicWeightDesc;

        double[] docTopWeights = generateTopTopicWeightVector(distIndex, inferenceOrderedDistribution);

        ObjectMapper mapper = new ObjectMapper();

        // 100 dimensions to match projection indexing
        String signature = RandomProjection.projectString(docTopWeights, config.getInt("smarts.lsh.numBits"));

        ElasticSearch es = ElasticSearch.getElasticSearch();
        Client esClient = es.getClient();

        /*
        SearchResponse response = esClient.prepareSearch("pancake-smarts")
        .setTypes("document")
        .setQuery(
                fuzzyQuery("features_bits", signature).minSimilarity((float) 0.6)
        )
        .setFrom(0).setSize(maxRecommendations)
        .execute()
        .actionGet();
        */
        SearchResponse response = esClient.prepareSearch("pancake-smarts").setTypes("document")
                .setQuery(filteredQuery(fuzzyQuery("features_bits", signature).minSimilarity((float) 0.6),
                        termFilter("topic_model_id", this.getId())))
                .setFrom(0).setSize(maxRecommendations).execute().actionGet();

        SearchHits hits = response.getHits();
        SearchHit[] hitArray = hits.getHits();

        long[] hitIds = new long[maxRecommendations];

        for (int hitIndex = 0; hitIndex < hitArray.length; hitIndex++) {
            SearchHit hit = hitArray[hitIndex];
            hitIds[hitIndex] = Long.parseLong(hit.getId());
        }

        List<Document> recommendedDocs = Ebean.find(Document.class).where()
                .in("id", ArrayUtils.toObject(hitIds)).findList();
        for (Document doc : recommendedDocs) {
            if (!allRecommendations.contains(doc.getUrl())) {
                recommendations.add(doc.getUrl());
                allRecommendations.add(doc.getUrl());
            }
        }
    }
    output.add(inferredWords);
    output.add(recommendations);
    output.add(distributionDesc);
    return output;
}

From source file:fr.moribus.imageonmap.migration.V3Migrator.java

private void mergeMapData() {
    PluginLogger.info(I.t("Merging map data..."));

    ArrayDeque<OldSavedMap> remainingMaps = new ArrayDeque<>();
    ArrayDeque<OldSavedPoster> remainingPosters = new ArrayDeque<>();

    ArrayDeque<Short> missingMapIds = new ArrayDeque<>();

    UUID playerUUID;/*from  www  .j  a va  2  s. c  o  m*/
    OldSavedMap map;
    while (!mapsToMigrate.isEmpty()) {
        map = mapsToMigrate.pop();
        playerUUID = usersUUIDs.get(map.getUserName());
        if (playerUUID == null) {
            remainingMaps.add(map);
        } else if (!map.isMapValid()) {
            missingMapIds.add(map.getMapId());
        } else {
            MapManager.insertMap(map.toImageMap(playerUUID));
        }
    }
    mapsToMigrate.addAll(remainingMaps);

    OldSavedPoster poster;
    while (!postersToMigrate.isEmpty()) {
        poster = postersToMigrate.pop();
        playerUUID = usersUUIDs.get(poster.getUserName());
        if (playerUUID == null) {
            remainingPosters.add(poster);
        } else if (!poster.isMapValid()) {
            missingMapIds.addAll(Arrays.asList(ArrayUtils.toObject(poster.getMapsIds())));
        } else {
            MapManager.insertMap(poster.toImageMap(playerUUID));
        }
    }
    postersToMigrate.addAll(remainingPosters);

    if (!missingMapIds.isEmpty()) {
        PluginLogger.warning(I.tn("{0} registered minecraft map is missing from the save.",
                "{0} registered minecraft maps are missing from the save.", missingMapIds.size()));
        PluginLogger.warning(I.t(
                "These maps will not be migrated, but this could mean the save has been altered or corrupted."));
        PluginLogger
                .warning(I.t("The following maps are missing : {0} ", StringUtils.join(missingMapIds, ',')));
    }
}

From source file:mil.jpeojtrs.sca.util.AnyUtils.java

/**
 * Internal function used to extract a sequence from an any.
 * /*  ww  w  .j  a  v a  2 s.co  m*/
 * @param theAny the Any to convert
 * @param contentType the TypeCode of the desired value
 * @return an array of Java objects from theAny that corresponds to the typeCode
 */
private static Object[] extractSequence(final Any theAny, final TypeCode contentType) {
    try {
        final TCKind kind = contentType.kind();
        switch (kind.value()) {
        case TCKind._tk_any:
            Any[] anyArray = AnySeqHelper.extract(theAny);
            Object[] objArray = new Object[anyArray.length];
            for (int i = 0; i < objArray.length; i++) {
                objArray[i] = AnyUtils.convertAny(anyArray[i]);
            }
            return objArray;
        case TCKind._tk_boolean:
            return ArrayUtils.toObject(BooleanSeqHelper.extract(theAny));
        case TCKind._tk_char:
            return ArrayUtils.toObject(CharSeqHelper.extract(theAny));
        case TCKind._tk_double:
            return ArrayUtils.toObject(DoubleSeqHelper.extract(theAny));
        case TCKind._tk_float:
            return ArrayUtils.toObject(FloatSeqHelper.extract(theAny));
        case TCKind._tk_long:
            return ArrayUtils.toObject(LongSeqHelper.extract(theAny));
        case TCKind._tk_longlong:
            return ArrayUtils.toObject(LongLongSeqHelper.extract(theAny));
        case TCKind._tk_octet:
            final byte[] octetArray = OctetSeqHelper.extract(theAny);
            final short[] shortArray = new short[octetArray.length];
            for (int i = 0; i < octetArray.length; i++) {
                shortArray[i] = UnsignedUtils.toSigned(octetArray[i]);
            }
            return ArrayUtils.toObject(shortArray);
        case TCKind._tk_short:
            return ArrayUtils.toObject(ShortSeqHelper.extract(theAny));
        case TCKind._tk_string:
            return StringSeqHelper.extract(theAny);
        case TCKind._tk_ulong:
            return ArrayUtils.toObject(UnsignedUtils.toSigned(ULongSeqHelper.extract(theAny)));
        case TCKind._tk_ulonglong:
            return UnsignedUtils.toSigned(ULongLongSeqHelper.extract(theAny));
        case TCKind._tk_ushort:
            return ArrayUtils.toObject(UnsignedUtils.toSigned(UShortSeqHelper.extract(theAny)));
        case TCKind._tk_wchar:
            return ArrayUtils.toObject(WCharSeqHelper.extract(theAny));
        case TCKind._tk_wstring:
            return WStringSeqHelper.extract(theAny);
        case TCKind._tk_null:
            return null;
        case TCKind._tk_sequence:
            if (PropertiesHelper.type().equivalent(contentType)) {
                return PropertiesHelper.extract(theAny);
            } else {
                return AnyUtils.extractSequence(theAny, contentType.content_type());
            }
        case TCKind._tk_alias:
            final TypeCode innerContentType = contentType.content_type();
            if (innerContentType.kind().value() == TCKind._tk_sequence) {
                return AnyUtils.extractSequence(theAny, innerContentType);
            } else {
                throw new IllegalArgumentException("Unsupported alias content type: " + innerContentType);
            }
        case TCKind._tk_struct:
            if (DataTypeHelper.type().equivalent(contentType)) {
                return PropertiesHelper.extract(theAny);
            } else {
                throw new IllegalArgumentException("Unsupported struct content type: " + contentType);
            }
        default:
            throw new IllegalArgumentException(
                    "Only primitive sequence types supported, unknown conversion: " + contentType);
        }
    } catch (final BAD_OPERATION ex) {
        return null;
    } catch (final BadKind e) {
        return null;
    }
}

From source file:com.ec.android.module.bluetooth40.base.BaseBluetoothControlWithProtocolActivity.java

/**
 * ?/*from   w  w w  . j a  va 2s .c  o m*/
 * TODO ?
 *
 * @param data
 */
private void onReceiveData(byte[] data) {
    if (data.length < 7) {
        //?7header??
        return;
    }
    //
    byte magic = data[0];

    if (magic != Packet.MAGIC_BYTE) {
        //?
        return;
    }
    //
    byte dataMuti = data[1];
    byte errFlag = (byte) (dataMuti & 0x08);
    //
    int payloadLength = data[2];

    if (payloadLength < 0) {
        payloadLength = 256 + payloadLength;
    }
    ////
    byte sequenceIdHigh8 = data[3];
    byte sequenceIdLow8 = data[4];
    //
    int sequenceIdHigh8Int = sequenceIdHigh8;
    int sequenceIdLow8Int = sequenceIdLow8;
    //
    if (sequenceIdHigh8 < 0) {
        sequenceIdHigh8Int = (256 + sequenceIdHigh8);
    }
    if (sequenceIdLow8 < 0) {
        sequenceIdLow8Int = (256 + sequenceIdLow8);
    }
    //
    //        short sequenceIdTemp = 0;
    //sequenceIdpacket
    short sequenceId = (short) ((sequenceIdHigh8Int << 8) + sequenceIdLow8Int);
    //
    if (errFlag == 0x08) {
        //??1
        mProtocolDataUtils.putErrFlag(sequenceId, true);
        return;
    } else {
        //???0
        mProtocolDataUtils.putErrFlag(sequenceId, false);
    }
    //
    byte ackFlag = (byte) (dataMuti & 0x04);
    if (ackFlag == 0x04) {
        //??1
        //packet?

    } else {
        //???
        //??
        //
        byte beginFlag = (byte) (dataMuti & 0x02);
        byte endFlag = (byte) (dataMuti & 0x01);
        //?packet
        //
        int myCrc = magic ^ data[1] ^ payloadLength ^ sequenceId;

        int crcHigh = data[5];
        int crcLow = data[6];

        if (crcHigh < 0) {
            crcHigh = 256 + crcHigh;
        }
        if (crcLow < 0) {
            crcLow = 256 + crcLow;
        }

        //            int crcTemp = 0x00;
        //
        int crc = (crcHigh << 8) + crcLow;

        if (crc != myCrc) {
            //?
            mProtocolDataUtils.removeGetDataMap(sequenceId);
            return;
        }
        //?
        byte[] bodyBytes = ArrayUtils.subarray(data, 7, data.length);
        //
        if (beginFlag == 0x02) {
            //??1?packet
            //packet??sequenceId??????
            mProtocolDataUtils.removeGetDataMap(sequenceId);
            mProtocolDataUtils.plusGetDataMap(sequenceId, ArrayUtils.toObject(bodyBytes));
        } else {
            //??0??packet
            //???sequenceId???
            ArrayList<Byte[]> getDataMapList = mProtocolDataUtils.getGetDataMap(sequenceId);
            if (getDataMapList == null || getDataMapList.isEmpty()) {
                return;
            } else {
                //??
                mProtocolDataUtils.plusGetDataMap(sequenceId, ArrayUtils.toObject(bodyBytes));
            }
        }
        //
        if (endFlag == 0x01) {
            //??1??packet
            //??
            ArrayList<Byte[]> getDataMapList = mProtocolDataUtils.getGetDataMap(sequenceId);

            if (getDataMapList != null) {
                Byte[] myAllBytes = null;
                for (Byte[] bytes : getDataMapList) {
                    myAllBytes = (Byte[]) ArrayUtils.addAll(myAllBytes, bytes);
                }
                //?
                mProtocolDataUtils.removeGetDataMap(sequenceId);
                //
                onActionDataAvailable(myAllBytes);
            }
        }
    }
    //
}

From source file:com.streamsets.pipeline.stage.destination.bigtable.BigtableTarget.java

@Override
public void write(final Batch batch) throws StageException {

    long counter = 0;

    if (conf.timeBasis == TimeBasis.BATCH_START) {
        timeStamp = System.currentTimeMillis();
    }//from   w  w  w.j  av a2s. c o m

    List<Put> theList = new ArrayList<>();
    Iterator<Record> recordIter = batch.getRecords();
    while (recordIter.hasNext()) {
        Record rec = recordIter.next();

        byte[] rowKey = buildRowKey(rec);
        if (rowKey.length == 0) {
            continue; // next record.
        }

        if (conf.timeBasis == TimeBasis.SYSTEM_TIME) {
            timeStamp = System.currentTimeMillis();

        } else if (conf.timeBasis == TimeBasis.FROM_RECORD) {
            Field f = rec.get(conf.timeStampField);
            if (f != null) {
                if (f.getType() == Field.Type.LONG) {
                    timeStamp = f.getValueAsLong();

                } else { // the field's data type is wrong.
                    errorRecordHandler.onError(new OnRecordErrorException(rec, Errors.BIGTABLE_08,
                            f.getType().name(), conf.timeStampField));
                    continue;

                }

            } else { // the field does not exist.
                errorRecordHandler
                        .onError(new OnRecordErrorException(rec, Errors.BIGTABLE_14, conf.timeStampField));
                continue; // next record.

            }
        }

        /* SDC-4628.  if "Ignore Missing Data Values" is enabled, we need to determine
        if any columns will be inserted for this record.
                
        if no data from any column will be inserted, this record probably should to go
        the On Record Error dest, since there will be no trace of this Row Key in
        Bigtable - at least one field has to be inserted so there is a record of
        this Row Key.
         */
        Map<String, Byte[]> values = new HashMap<>();

        int nullFields = 0;
        int cantConvert = 0;
        for (BigtableFieldMapping f : conf.fieldColumnMapping) {
            Field tempField = rec.get(f.source);
            if (tempField == null) {
                nullFields++;

            } else {
                // field exists - check if it's convertible.
                try {
                    values.put(f.source, ArrayUtils.toObject(convertValue(f, tempField, rec)));
                } catch (OnRecordErrorException ex) {
                    cantConvert++;
                }
            }
        }

        // any conversion failures go to record error.
        if (cantConvert > 0) {
            errorRecordHandler.onError(new OnRecordErrorException(rec, Errors.BIGTABLE_23));
            continue;
        }

        if (!conf.ignoreMissingFields) {
            if (nullFields > 0) { // missing fields, not ignoring them - record goes to error.
                errorRecordHandler.onError(new OnRecordErrorException(rec, Errors.BIGTABLE_23));
                continue;
            }
        } else {
            // null field count matches field path count.  all columns are null.
            if (nullFields == conf.fieldColumnMapping.size()) {
                errorRecordHandler.onError(new OnRecordErrorException(rec, Errors.BIGTABLE_23));
                continue; // next record.
            }
        }

        Put put = new Put(rowKey, timeStamp);

        for (BigtableFieldMapping f : conf.fieldColumnMapping) {
            theList.add(put.addColumn(destinationNames.get(f.column).columnFamily,
                    destinationNames.get(f.column).qualifier, timeStamp,
                    ArrayUtils.toPrimitive(values.get(f.source))));
        }

        counter++;
        if (counter >= conf.numToBuffer) {
            commitRecords(theList);
            theList.clear();
            counter = 0;
        }
    }

    // commit any "leftovers".
    if (counter > 0) {
        commitRecords(theList);
    }
}

From source file:com.flexive.core.security.UserTicketImpl.java

/**
 * Returns a string representation of the ticket.
 *
 * @return a string representation of the ticket.
 *///from w ww  .  j  a v  a  2  s . c  o  m
@Override
public String toString() {
    return this.getClass() + "@[" + "id=" + this.userId + "; contactData=" + this.contactData + "; name:"
            + this.userName + "; mandator:" + this.mandator + "; language: " + this.getLanguage().getIso2digit()
            + "; groups:" + StringUtils.join(ArrayUtils.toObject(this.groups), ',') + "; roles:"
            + StringUtils.join(FxSharedUtils
                    .getSelectableObjectIdList(Arrays.asList((SelectableObjectWithLabel[]) this.roles)), ',')
            + "; globalSupervisor:" + this.globalSupervisor + "; multiLogin:" + this.multiLogin + "]";

}

From source file:it.tizianofagni.sparkboost.DataUtils.java

public static int getNumLabels(JavaRDD<MultilabelPoint> documents) {
    if (documents == null)
        throw new NullPointerException("The documents RDD is 'null'");
    int maxValidLabelID = documents.map(doc -> {
        List<Integer> values = Arrays.asList(ArrayUtils.toObject(doc.getLabels()));
        if (values.size() == 0)
            return 0;
        else/*from w w w. j ava  2 s.c o  m*/
            return Collections.max(values);
    }).reduce((m1, m2) -> Math.max(m1, m2));
    return maxValidLabelID + 1;
}

From source file:mil.jpeojtrs.sca.util.tests.AnyUtilsTest.java

@Test
public void test_convertAnySequences() throws Exception {
    // Test Strings
    Object obj = null;/*from w w  w  .  j a v a 2  s  .  c  o  m*/
    Any theAny = JacorbUtil.init().create_any();

    final String[] stringInitialValue = new String[] { "a", "b", "c" };
    StringSeqHelper.insert(theAny, stringInitialValue);
    final String[] stringExtractedValue = StringSeqHelper.extract(theAny);
    // Sanity Check
    Assert.assertTrue(Arrays.equals(stringInitialValue, stringExtractedValue));

    // The real test
    obj = AnyUtils.convertAny(theAny);
    Assert.assertTrue(obj instanceof String[]);
    Assert.assertTrue(Arrays.equals(stringInitialValue, (String[]) obj));

    // Test Doubles
    obj = null;
    theAny = JacorbUtil.init().create_any();

    final double[] doubleInitialValue = new double[] { 0.1, 0.2, 0.3 };
    DoubleSeqHelper.insert(theAny, doubleInitialValue);
    final double[] doubleExtractedValue = DoubleSeqHelper.extract(theAny);
    // Sanity Check
    Assert.assertTrue(Arrays.equals(doubleInitialValue, doubleExtractedValue));

    // The real test
    obj = AnyUtils.convertAny(theAny);
    Assert.assertTrue(obj instanceof Double[]);
    Assert.assertTrue(Arrays.equals(ArrayUtils.toObject(doubleInitialValue), (Double[]) obj));

    // Test Integers
    obj = null;
    theAny = JacorbUtil.init().create_any();

    final int[] intInitialValue = new int[] { 1, 2, 3 };
    LongSeqHelper.insert(theAny, intInitialValue);
    final int[] intExtractedValue = LongSeqHelper.extract(theAny);
    // Sanity Check
    Assert.assertTrue(Arrays.equals(intInitialValue, intExtractedValue));

    // The real test
    obj = AnyUtils.convertAny(theAny);
    Assert.assertTrue(obj instanceof Integer[]);
    Assert.assertTrue(Arrays.equals(ArrayUtils.toObject(intInitialValue), (Integer[]) obj));

    // Test Recursive Sequence
    obj = null;
    final Any[] theAnys = new Any[2];
    theAnys[0] = JacorbUtil.init().create_any();
    theAnys[1] = JacorbUtil.init().create_any();

    LongSeqHelper.insert(theAnys[0], intInitialValue);
    LongSeqHelper.insert(theAnys[1], intInitialValue);
    AnySeqHelper.insert(theAny, theAnys);

    // The real test
    obj = AnyUtils.convertAny(theAny);
    Assert.assertTrue(obj instanceof Object[]);
    int[] extractedIntArray = ArrayUtils.toPrimitive((Integer[]) ((Object[]) obj)[0]);
    Assert.assertTrue(Arrays.equals(intInitialValue, extractedIntArray));
    extractedIntArray = ArrayUtils.toPrimitive((Integer[]) ((Object[]) obj)[1]);
    Assert.assertTrue(Arrays.equals(intInitialValue, extractedIntArray));

    String[] str = (String[]) AnyUtils
            .convertAny(AnyUtils.toAnySequence(new String[] { "2", "3" }, TCKind.tk_string));
    Assert.assertEquals("2", str[0]);
    str = (String[]) AnyUtils.convertAny(AnyUtils.toAnySequence(new String[] { "3", "4" }, TCKind.tk_wstring));
    Assert.assertEquals("3", str[0]);
    final Boolean[] bool = (Boolean[]) AnyUtils
            .convertAny(AnyUtils.toAnySequence(new boolean[] { false, true }, TCKind.tk_boolean));
    Assert.assertTrue(bool[1].booleanValue());
    final Short[] b = (Short[]) AnyUtils
            .convertAny(AnyUtils.toAnySequence(new byte[] { Byte.MIN_VALUE, Byte.MAX_VALUE }, TCKind.tk_octet));
    Assert.assertEquals(Byte.MAX_VALUE, b[1].byteValue());
    Character[] c = (Character[]) AnyUtils
            .convertAny(AnyUtils.toAnySequence(new char[] { 'r', 'h' }, TCKind.tk_char));
    Assert.assertEquals('h', c[1].charValue());
    c = (Character[]) AnyUtils
            .convertAny(AnyUtils.toAnySequence(new Character[] { '2', '3' }, TCKind.tk_wchar));
    Assert.assertEquals('2', c[0].charValue());
    final Short[] s = (Short[]) AnyUtils.convertAny(
            AnyUtils.toAnySequence(new short[] { Short.MIN_VALUE, Short.MAX_VALUE }, TCKind.tk_short));
    Assert.assertEquals(Short.MAX_VALUE, s[1].shortValue());
    final Integer[] i = (Integer[]) AnyUtils.convertAny(
            AnyUtils.toAnySequence(new int[] { Integer.MIN_VALUE, Integer.MAX_VALUE }, TCKind.tk_long));
    Assert.assertEquals(Integer.MAX_VALUE, i[1].intValue());
    final Long[] l = (Long[]) AnyUtils.convertAny(
            AnyUtils.toAnySequence(new long[] { Long.MIN_VALUE, Long.MAX_VALUE }, TCKind.tk_longlong));
    Assert.assertEquals(Long.MAX_VALUE, l[1].longValue());
    final Float[] f = (Float[]) AnyUtils.convertAny(
            AnyUtils.toAnySequence(new float[] { Float.MIN_VALUE, Float.MAX_VALUE }, TCKind.tk_float));
    Assert.assertEquals(Float.MAX_VALUE, f[1].floatValue(), 0.00001);
    final Double[] d = (Double[]) AnyUtils.convertAny(
            AnyUtils.toAnySequence(new double[] { Double.MIN_VALUE, Double.MAX_VALUE }, TCKind.tk_double));
    Assert.assertEquals(Double.MAX_VALUE, d[1].doubleValue(), 0.00001);
    final Integer[] us = (Integer[]) AnyUtils.convertAny(
            AnyUtils.toAnySequence(new short[] { Short.MIN_VALUE, Short.MAX_VALUE }, TCKind.tk_ushort));
    Assert.assertEquals(Short.MAX_VALUE, us[1].intValue());
    final Long[] ui = (Long[]) AnyUtils.convertAny(
            AnyUtils.toAnySequence(new int[] { Integer.MIN_VALUE, Integer.MAX_VALUE }, TCKind.tk_ulong));
    Assert.assertEquals(Integer.MAX_VALUE, ui[1].longValue());
    final BigInteger[] ul = (BigInteger[]) AnyUtils.convertAny(AnyUtils
            .toAnySequence(new BigInteger[] { new BigInteger("2"), new BigInteger("3") }, TCKind.tk_ulonglong));
    Assert.assertEquals(3L, ul[1].longValue());

}