像python中一样的Java slice数组 [英] Java slice array as in python
本文介绍了像python中一样的Java slice数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Java中有一个字节数组,需要获取它的一部分。我想使用Java数组,就像使用Python列表一样使用切片。 Java中有类似的东西吗?预先谢谢您。
I have an byte array in Java and need to get parts of it. I wanted to work with Java arrays in the same way as I work with Python list, using slices. There is something similar to this in Java? Thank you in advance.
推荐答案
您可以使用Arrays( http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html )内置 Arrays#copyOfRange()
You can use Arrays(http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html) build-in Arrays#copyOfRange()
Arrays.copyOfRange(oldArray, startIndex, endIndex);
这篇关于像python中一样的Java slice数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文