Java ListIterator Usage toInt(final List digits, final int base)

Here you can find the source of toInt(final List digits, final int base)

Description

to Int

License

Open Source License

Declaration

public static int toInt(final List<Integer> digits, final int base) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.List;
import java.util.ListIterator;

public class Main {
    public static int toInt(final List<Integer> digits, final int base) {
        int pos = 1;
        int retVal = 0;
        for (ListIterator<Integer> it = digits.listIterator(digits.size()); it
                .hasPrevious();) {/* w ww.  j  a v  a  2s .c om*/
            retVal += it.previous() * pos;
            pos = pos * base;
        }
        return retVal;
    }
}

Related

  1. stringToList(String commas)
  2. stripQuotes(List input)
  3. toArray(List a)
  4. toCFML(Object obj)
  5. toCharArrays(List strings)
  6. toIntegerArray(List list)
  7. toLowerCase(List list)
  8. toLowerCase(List stringList)
  9. toposort(Iterable items, Comparator partOrder)