Splitting integers in Android
<p>In relation to my last question about <a href="https://stackoverflow.com/questions/37815786/how-to-set-textview-as-method-output-in-andrioid">setting the TextView as the method output</a> this question is about splitting the integer into separate digits. My Roman Numeral program works by using the translator method here: </p>

<pre><code>'public static String translator(int integer) {
        String result = "";
        LinkedList&lt;String&gt; stack = new LinkedList&lt;String&gt;();
        // if (integer &gt; 0 &amp;&amp; integer &lt;= 4999) {
        //ArrayList&lt;Integer&gt; placement = new ArrayList&lt;Integer&gt;();
        int place = (int) Math.log10(integer);
        for (int i = 0; i &lt;= place; i++) {
            //while(integer &gt; 0){
            //System.out.println(integer);
            int placeOfValue = integer % 10;
            //stack.push(placeOfValue);
            //System.out.print(stack);

            //System.out.print(placeOfValue +":" + i);
            String placement = "";
            switch (i) {
                case 0:
                    placement = ones(placeOfValue);

                    break;
                case 1:
                    placement = tens(placeOfValue);

                    break;
                case 2:
                    placement = hundreds(placeOfValue);

                    break;
                case 3:
                    placement = thousands(placeOfValue);

                    break;
                default:
                    break;
            }

            if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.GINGERBREAD) {
                stack.push(placement);

            }
            integer = integer / 10;

            //System.out.print(placement);
            // System.out.println(placement.size());
            //}
//              for(int j = 0; j &lt; placement.size(); j++){
//                                    double tenthPower = Math.floor(Math.log10(placement.get(j)));
//                                    double place = Math.pow(10, tenthPower);
//                                    System.out.println(place);
//
//              }
            // }

            while (!stack.isEmpty()) {
                if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.GINGERBREAD) {
                    result += stack.pop();
                    //System.out.print(stack.pop());
                }

            }

//        } else {
//            System.out.println("Please enter an integer between 0 and 4,999.");
//        }

        }
        return result;
    }
</code></pre>

<p>`</p>

<p>The translator method works by going through the for loop which will loop through the size of the integer then assigning the digit a given placement. From the placement it will then look through the placement methods and return the numeral. Since the integers are added in reverse for the LinkedList I have pushed the stack and popped it based on this post <a href="https://stackoverflow.com/questions/3389264/how-to-get-the-separate-digits-of-an-int-number">How to get the separate digits of an int number?</a> to get the correct order. However the program continues to print out the numerals in reverse order which is not what I want. I have debugged the program but with no luck it feels like something is off with the pop method and adding it to the output but I can't figure out what.</p>