Java tutorial
//package com.java2s; public class Main { public static int transponderAsParam(final int code) { int param = 0; int divisor = 1; for (int i = 0; i < 4; i++) { // pick off the digit, then re-interpret as hex final int digit = (code / divisor) % 10; param += digit * Math.pow(16, i); divisor *= 10; } return param; } }