D
Dinesh
HELLO.....I M NOT ABLE TO GET WHAT IS THE PROBLEM WITH MY
PROGRAM....PLZ LET ME KNOW THAT
class LtoSa
{
public static void main(String args[])
{
long l = Long.parseLong(args[0]);
short[] buf1 = new short[4];
//for(short s1 = (short)9999;s1<=9999;s1++)
//{
buf1[0]=(short)((l & 0xffff000000000000l)>>48);
buf1[1]=(short)((l & 0x0000ffff00000000l)>>32);
buf1[2]=(short)((l & 0x00000000ffff0000l)>>16);
buf1[3]=(short) (l & 0x000000000000ffffl);
//buf[1] = 0;
//System.out.print(s1+":\t");
for(int j = 0; j<4;j++)
{
System.out.print(buf1[j]+"\t");
}
System.out.println();
//}
l |= buf1[0] & 0xFFFF;
l <<= 16;
l |= buf1[1] & 0xFFFF;
l <<= 16;
l |= buf1[2] & 0xFFFF;
l <<= 16;
l |= buf1[3] & 0xFFFF;
System.out.println("Long value:"+l);
}
}
PROGRAM....PLZ LET ME KNOW THAT
class LtoSa
{
public static void main(String args[])
{
long l = Long.parseLong(args[0]);
short[] buf1 = new short[4];
//for(short s1 = (short)9999;s1<=9999;s1++)
//{
buf1[0]=(short)((l & 0xffff000000000000l)>>48);
buf1[1]=(short)((l & 0x0000ffff00000000l)>>32);
buf1[2]=(short)((l & 0x00000000ffff0000l)>>16);
buf1[3]=(short) (l & 0x000000000000ffffl);
//buf[1] = 0;
//System.out.print(s1+":\t");
for(int j = 0; j<4;j++)
{
System.out.print(buf1[j]+"\t");
}
System.out.println();
//}
l |= buf1[0] & 0xFFFF;
l <<= 16;
l |= buf1[1] & 0xFFFF;
l <<= 16;
l |= buf1[2] & 0xFFFF;
l <<= 16;
l |= buf1[3] & 0xFFFF;
System.out.println("Long value:"+l);
}
}