source code name: ConversionDemo.java

class ConversionDemo
{
void convert(int n, String s) // method over loaded with integer and String ( type 1)
{
int b=0,i;
int rem[]=new int[10];
i=0;
if(s.equals("binary"))
{
b=2;
System.out.print("\nBinary Conversion: ");
}

if(s.equals("octal"))
{
b=8;
System.out.print("\nOctal Conversion: ");
}
if(s.equals("hexa"))
{
b=16;
System.out.print("\nHexadecimal Conversion: ");
}
 while(n>0)
{
rem[i]=n%b;
n=n/b;
i++;
}
for(i=i-1;i>=0;i--)
{
if(rem[i]>9)
System.out.print((char)(rem[i]+55)+" ");
else
System.out.print(rem[i]+" ");
}
}
void convert(int n, int b) // method over loaded with integer and integer(type 2)
{
int i=0;
int rem[]=new int[10];
if(b==2)
{
System.out.print("\nBinary Conversion: ");
}

if(b==8)
{
System.out.print("\nOctal Conversion: ");
}
if(b==16)
{
System.out.print("\nHexadecimal Conversion: ");
}
 while(n>0)
{
rem[i]=n%b;
n=n/b;
i++;
}
for(i=i-1;i>=0;i--)
{
if(rem[i]>9)
System.out.print((char)(rem[i]+55)+" ");
else
System.out.print(rem[i]+" ");
}
}

public static void main(String[] arg)
 {
ConversionDemo ob=new ConversionDemo();
ob.convert(100,"binary"); // calling of method overloading type 1
ob.convert(100,8);    // calling of method overloading type 2
ob.convert(100,"hexa");
ob.convert(253,"octal");
ob.convert(253,"hexa");
ob.convert(1000,2);
ob.convert(100,16);
 }
}

output:

D:\JavaPrograms> java ConversionDemo

Binary Conversion: 1 1 0 0 1 0 0
Octal Conversion: 1 4 4
Hexadecimal Conversion: 6 4
Octal Conversion: 3 7 5
Hexadecimal Conversion: F D
Binary Conversion: 1 1 1 1 1 0 1 0 0 0
Hexadecimal Conversion: 6 4