how do i circular left shift a byte array by 25 bits

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ankitabhatia
    New Member
    • Feb 2010
    • 8

    how do i circular left shift a byte array by 25 bits

    i ave a byte array..ave 2 left shift it by 25 bits..
    to be able 2 reuse de elements of de array..
    ave to do this for encryption algo..
    ne help will b gr8..thnx a lot:):)

    btw i need it in java...thnx again!!!
  • anurag275125
    New Member
    • Aug 2009
    • 79

    #2
    did you use left shift operator (<<) like this...
    bytearry[i]<<25

    Comment

    • ankitabhatia
      New Member
      • Feb 2010
      • 8

      #3
      ya i did dat..bt its givin all zeros!!!

      Comment

      • anurag275125
        New Member
        • Aug 2009
        • 79

        #4
        This program takes three bytes from keyboard and then left shift each byte of array by 25 bits..

        Code:
        import java.util.*;
        public class bytearray
        {
        	static Scanner sc=new Scanner(System.in);
        	public static void main(String args[])
        	{
        		byte[] b=new byte[3];
        		for(int i=0;i<b.length;i++)
        			b[i]=sc.nextByte();
        		for(int i=0;i<b.length;i++)
        			System.out.println(b[i]<<25);
        	}
        }

        is this help you?

        Comment

        • ankitabhatia
          New Member
          • Feb 2010
          • 8

          #5
          thank u very much !!

          Comment

          Working...