Here you can find the source of toStack(int[] input)
public static final Stack<Integer> toStack(int[] input)
//package com.java2s; //License from project: Open Source License import java.util.Stack; public class Main { public static final Stack<Integer> toStack(int[] input) { Stack<Integer> stack = new Stack<>(); appendToStack(stack, input);/*w w w.j a v a2s.co m*/ return stack; } public static final void appendToStack(Stack<Integer> stack, int[] input) { for (int inputValue : input) { stack.push(inputValue); } } }