title: Calculate sum of the digits to the consecutive power in given number
body: <p>What is the best way to calculate sum of the digits to the consecutive power in a method?</p>
  
  <p>Examples: </p>
  
  <pre><code>calculateSum(5) -&gt; returns 5^1 = 5
  12 -&gt; 1^1 + 2^2 = 5
  26 -&gt; 2^1 + 6^2 = 38
  122 -&gt; 1^1 + 2^2 + 2^3 = 13
  </code></pre>
  
  <p>I wanted to use stream because I'm trying to practice some J8 functionalities but couldn't find a way to make it work.</p>
  
  <p>EDIT: I need it to solve this kata: <a href="https://www.codewars.com/kata/5626b561280a42ecc50000d1/train/java" rel="nofollow noreferrer">https://www.codewars.com/kata/5626b561280a42ecc50000d1/train/java</a></p>
  
  <p>EDIT2: Here is my code so far:</p>
  
  <pre><code>public static void calculateSum(int input) {
      String[] number = String.valueOf(input).split("");
      Map&lt;Integer, Integer&gt; map = Arrays.stream(number)
              .map(Integer::valueOf)
              .map(d -&gt; (int) Math.pow(d, list.indexOf(d)))
              .collect(Collectors.toMap(d));
  }
  </code></pre>
  
  <p>I don't know how to map digits from <code>number array</code> with their consecutive powers so then I can just sum values from that map.</p>