Hello, all!

I have a (hopefully) quick question:

I have an array of 128 ASCII characters called blockData[] that I am trying to convert into a string.

for (int i = 0; i < 128; i++){
                blockStuff = inFile.read();
                blockData[i] = blockStuff;
                if (blockData[i] != 0){                    
                String aChar = Character.toString ((char)blockData[i]);
                word += aChar;
                }
            }
            System.out.println("Word is " + word);

My current output is:

Word is null...
lost+foundnagios-3.2.0.tar.gz88nagios-3.2.0$Pi - Dec - Chudnovsky.txt

Now my question is...what is causing those squares in the output? It appears that they are at the indexes where blockData[] == 0.

Any ideas on how I can eliminate them?

Thank you for any input

- Jim

Oh I figured it out! It was spots where dataArray[] were set to the values of 0, 1, 19, 20, and a couple others. Thanks!

- Jim

Also look at printf which is extremely useful

Thank you! I'll check that out!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.