import java.util.*; public class Test { public int mask = 0xFF; public Test(int num) { int2char(num); } public void int2char(int num) { char[] buf = new char[4]; for(int i=0; i<4; i++) { char xx = (char)(num & mask); buf[i] = xx; System.out.println((int)buf[i]); num = num >> 8; } char2int(buf); } public void char2int(char[] bytes) { int number = 0; int temp = 0; for(int i=0; i<4; i++) { temp = (int)bytes[i]; number += temp << (8*i); System.out.println("Number is: " + number); } } public static void main(String[] args) { System.out.println("Input is: " + args[0]); Integer num = new Integer(args[0]); Test test = new Test(num.intValue()); System.exit(0); } }