【发布时间】:2012-02-25 13:04:02
【问题描述】:
我试图将这段代码翻译成python,但我很难这样做,不要担心索引值和变量名,我只想知道“>>>”部分究竟做了什么,也许一个python等价物,但解释会很好:
target[0] = (char)(source[sourceIndex] >>> 2);
target[1] = (char)((source[sourceIndex] & 3) << 4 | source[sourceIndex + 1] >>> 4);
target[2] = (char)((source[sourceIndex + 1] & 0xf) << 2 | source[sourceIndex + 2] >>> 6);
target[3] = (char)(source[sourceIndex + 2] & 0x3f);
任何帮助将不胜感激
【问题讨论】:
-
在 Google 上很难搜索到 '>>>'。
-
@Eels:这有点不公平,因为正确的搜索是“Java 运算符”而不是“java >>>”之类的东西可能并不明显。
-
我不知道这叫什么,所以谷歌搜索“java >>>”根本没有返回任何有用的东西。