Results 1 to 9 of 9
- 06-29-2010, 07:15 PM #1
Member
- Join Date
- Jun 2010
- Posts
- 6
- Rep Power
- 0
- 06-29-2010, 08:23 PM #2
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
- 06-29-2010, 08:38 PM #3
Member
- Join Date
- Jun 2010
- Posts
- 6
- Rep Power
- 0
Its 64 bits
- 06-29-2010, 09:41 PM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,395
- Blog Entries
- 7
- Rep Power
- 17
- 06-30-2010, 03:04 AM #5
Senior Member
- Join Date
- Dec 2008
- Posts
- 526
- Rep Power
- 0
String class uses char array to combine a text line.
Just do next 64/16=4
So "text" is 64 bits word ;)If my answer helped you. Please click my "REP" button and add a comment
Have a Good Java Coding :)
- 06-30-2010, 09:30 AM #6
Moderator
- Join Date
- Apr 2009
- Posts
- 10,448
- Rep Power
- 16
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?
- 06-30-2010, 10:50 AM #7
Member
- Join Date
- Jun 2010
- Posts
- 6
- Rep Power
- 0
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
- 06-30-2010, 10:58 AM #8
Moderator
- Join Date
- Apr 2009
- Posts
- 10,448
- Rep Power
- 16
Ah, so Norm and I got the question wrong...:)
- 06-30-2010, 11:33 AM #9
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,395
- Blog Entries
- 7
- Rep Power
- 17
Similar Threads
-
The constructor Person(String, String, Date) is undefined
By fh84 in forum New To JavaReplies: 7Last Post: 11-03-2009, 02:18 AM -
combine string[] into string like perl's join function
By tekberg in forum Advanced JavaReplies: 9Last Post: 02-23-2009, 01:05 PM -
Let eclipse warn about a semicolon after an if statement and string == string?
By foobar.fighter in forum EclipseReplies: 5Last Post: 01-11-2009, 10:12 AM -
Using java.util.Scanner to search for a String in a String
By Java Tip in forum Java TipReplies: 0Last Post: 11-20-2007, 04:59 PM -
I can't seem to pass the value of a string variable into a string array
By mathias in forum Java AppletsReplies: 1Last Post: 08-03-2007, 10:52 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks