Java tutorial
//package com.java2s; import java.math.BigInteger; public class Main { public static BigInteger sumRights(int[] rights) { BigInteger num = new BigInteger("0"); for (int i = 0; i < rights.length; i++) { num = num.setBit(rights[i]); } return num; } public static BigInteger sumRights(String[] rights) { BigInteger num = new BigInteger("0"); for (int i = 0; i < rights.length; i++) { num = num.setBit(Integer.parseInt(rights[i])); } return num; } }