FactorialCallable.java 383 Bytes
Newer Older
Gabriele Civitarese's avatar
Gabriele Civitarese committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
package callable;

import java.util.concurrent.Callable;

public class FactorialCallable implements Callable<Long> {

    private int number;

    public FactorialCallable(int number){
        this.number = number;
    }

    @Override
    public Long call() {
        Long result = 1L;

        for(int i = 1; i<=number; i++)
            result*=i;

        return result;

    }
}