View Single Post
Old Apr 4th, 2008, 2:19 PM   #1
Abyss
Newbie
 
Join Date: Apr 2005
Posts: 18
Rep Power: 0 Abyss is on a distinguished road
Pass integers to an array?

I'm trying to do something similar to passing a string to an array, as in the following piece of code:

String encryptMe = "Test"

char[] characters;
characters = encryptMe.toCharArray();

This is my attempt to do the same thing, only I'm trying to add numeric values to the array rather than characters. The errors I've got are "int cannot be dereferenced" and also "incompatiable types". I've read that ints can't be used in this case...though I've tried the same thing with long data types and got the same results.

int x;
int i;
char[] characters;
characters = encryptMe.toCharArray();
int[] numeric;

for (x=0; x<characters.length; x++)
	    {
	  int a = characters[x];
	  i = a - 96;
	  numeric = (int) i.toNumArray();
	    }

Any suggestions on how to achieve this the right way?

Thanks
Abyss is offline   Reply With Quote