Hi,
I want to ask that how can i get 64-bit from a String?
Eg:
String ss = "I want to ask that how can i get 64-bit from a String?";
How can I get 64-bit from ss?
Printable View
Hi,
I want to ask that how can i get 64-bit from a String?
Eg:
String ss = "I want to ask that how can i get 64-bit from a String?";
How can I get 64-bit from ss?
I take it you are talking about Strings not bits.
If you know the offset of the desired substring, use the substring method.
To get the offset use the indeOf method
Its 64 bits
String class uses char array to combine a text line.
Just do next 64/16=4
So "text" is 64 bits word ;)
Re-reading the OP, I think (as Norm does) that they're asking how to get the text "64-bits" from another text string...but I can't actually see the point. In order to get that text, you'd have to use that text to find the index for it, which you'd then use to get...the test...which you already have.
Unless it's actually a "does this text exist in this String" question, in which case a simple indexOf would do the trick.
All in all, not the best worded question we've had...so can you clarify please?
Lets say there is a string "Hello world"
I wish to split the string above to 64-bits each.
And the result that I want is in bit.
Maybe the following will helps:
Use getBytes function, and then combine each group of 8 using left shifts and the bitwise or operator.
Can one provide with the sample coding? Cause I'm new to Java =(
Thanks
Ah, so Norm and I got the question wrong...:)
Have a look at the ByteBuffer class: given you byte[] wrap it in a ByteBuffer and get a long out of it.
kind regards,
Jos