小编Hot*_*fin的帖子

int的错误无法解除引用?

我这个构造函数出错了,我不知道如何修复?我是java的初学者.这是我试图学习的一个示例练习:

/** 
 * Create an array of size n and store a copy of the contents of the
 * input argument
 * @param intArray array of elements to copy 
*/
public IntArray11(int[] intArray)
{
    int i = 0;
    String [] Array = new String[intArray.length];
    for(i=0; i<intArray.length; ++i)
    {
    Array[i] = intArray[i].toString();
    }
}
Run Code Online (Sandbox Code Playgroud)

java arrays

3
推荐指数
3
解决办法
3万
查看次数

从 int 到 byte 的有损转换?

我作为练习所做的简单加密算法给了我一个可能的从 int 到 byte 的有损转换?但我不知道为什么它会给我这个错误任何想法?

public class Rot13Crypt extends CryptStream
{
    public Rot13Crypt(StreamPair theStreams)
    {
        super(theStreams);
    }
    protected byte [] cryptData(byte [] data, int len)
    {
        byte [] cryptedByte = new byte[len];
        for(int i = 0; i < len; i++)
        {
            cryptedByte[i] = (data[i] + 13) % 256;
        }
        return cryptedByte;
    }
    protected byte [] decryptData(byte [] data, int len)
    {
        byte [] decryptedByte = new byte[len];
        for(int i = 0; i < len; i++)
        {
            decryptedByte[i] = (data[i] * …
Run Code Online (Sandbox Code Playgroud)

java encryption

3
推荐指数
1
解决办法
2万
查看次数

标签 统计

java ×2

arrays ×1

encryption ×1