Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.util.LinkedList;

public class Main {
    public static int insertX(int numb, int random) {
        long result = 0;
        LinkedList<Integer> stack = new LinkedList<Integer>();
        while (numb > 0) {
            stack.push(numb % 10);
            numb = numb / 10;
        }

        while (!stack.isEmpty()) {
            result = (int) combinedTwoNumber(result, stack.pop());
            result = (int) combinedTwoNumber(result, random);
        }

        return (int) (result /= 10);
    }

    public static long combinedTwoNumber(long a, long b) {
        return Long.valueOf(String.valueOf(a) + String.valueOf(b));
    }
}