Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class Main {
    public static <P extends Collection<BigInteger>> List<Long> convertAllElementsToLong(P bigIntegers) {
        if (bigIntegers == null) {
            return null;
        }
        try {
            ArrayList<Long> results = new ArrayList<Long>();
            for (BigInteger bigInteger : bigIntegers) {
                results.add(bigInteger.longValue());
            }
            return results;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}