【发布时间】:2014-05-10 13:55:09
【问题描述】:
我正在尝试 swa 位,但我有一个字符串,其中包含位于第一个 index[1] =1001 和第二个 index[2]=0010 的二进制文件
我想在那里交换位像
1001 and 0010 after bits swaps it becomes 1010 and 0001 and so on.
for example
A (array in string)
1. 1001
2. 0011
3. 1010
4. 0101
.
.
.
now I want to swap the 1st two bits of 1 st string with 2nd string last 2 bits then 1st strings bit with 3rd so on
result :
1011
0001
1000
1011
我也应用了这个:
String array[] = gf.split("\\", -1);但没有成功
我只需要将字符串拆分为数组。所以只是需要帮助,非常感谢你:)
【问题讨论】:
-
请贴出你已有的代码。
-
我只需要知道我将如何拆分字符串。我应用了这个,但编译器要求用长度替换
-
再次要求更改长度。我不知道为什么会这样。我的编译器是 ecilipse。
-
你想交换字符串中索引 2 和 3 的字符吗?
标签: java