473,387 Members | 1,495 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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!!!
Mar 2 '10 #1
4 9753
did you use left shift operator (<<) like this...
bytearry[i]<<25
Mar 2 '10 #2
ya i did dat..bt its givin all zeros!!!
Mar 2 '10 #3
This program takes three bytes from keyboard and then left shift each byte of array by 25 bits..

Expand|Select|Wrap|Line Numbers
  1. import java.util.*;
  2. public class bytearray
  3. {
  4.     static Scanner sc=new Scanner(System.in);
  5.     public static void main(String args[])
  6.     {
  7.         byte[] b=new byte[3];
  8.         for(int i=0;i<b.length;i++)
  9.             b[i]=sc.nextByte();
  10.         for(int i=0;i<b.length;i++)
  11.             System.out.println(b[i]<<25);
  12.     }
  13.  
}

is this help you?
Mar 2 '10 #4
thank u very much !!
Mar 6 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Simon Johnson | last post by:
Is there an inbuilt circular shift operator in c#? I've googled it but because c# happens to be musical note.. i get a large noise to signal ratio :P Simon.
4
by: Kevin | last post by:
I was looking through some source code and noticed the used of the C# << operator. Why is this being used here and under what circumstances is an left-shift operator useful. internal enum...
11
by: Kenneth Lantrip | last post by:
Anyone got any ideas as to how this process could be improved for speed? this is what I have... Dim j, q As Integer Dim x(16), y(16) As Byte x.CopyTo(y, 0) ' shift left circular 24 bits
4
by: Lance | last post by:
I have an array of bytes that I need to convert into an array of Integers. But, the number of bits per value in the Byte array is not necessarily divisible by 8 (although it will never exceed...
7
by: Marty McFly | last post by:
Hello VB Gurus, I have an unusual requirement to shift an unsigned int right one bit: Dim myVar As UInt32 = UInt32.Parse("123456") Dim myResult As UInt32 myResult = myVar >> 1 However, the...
19
by: aurgathor | last post by:
I use BC 5.02 (long is 32 bit) and I wonder if there's any efficient code that would allow me to left shift 64 bit values that I currently use this way: typedef struct { unsigned long lsLong;...
7
by: yancheng.cheok | last post by:
hello all, in my memory content says, 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8 ... 0xff i wish to shift it n bits. please note that, not n bye, but n bit, and n can be any value 0, 1,...
4
by: sandhya | last post by:
Hello Folks, i hava a problem in coding of circular left shift of 25 bits in my program...how do i perform it, and how do i use unsigned in VB. My program (IDEA algorithm implementation in VB) ...
56
by: Christian Christmann | last post by:
Hi, in the header of my class I've a constant static const int a = ( 1 << 32 ) - 1; When compiling the code, g++ issues the warning "warning: left shift count >= width of type" Why? And...
7
by: Bint | last post by:
Hi, What is a simple way to shift the elements in an array, circularly? Is there a way to do it so that you don't need a separate storage array? IE I want to shift array A{1,2,3,4,5,6,7,8} by...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.