yes this is my first post, yes i am trying to get a shell account.... but i figured, i was going to post this on some forum anyways, may as well be here.
anyways........
i'm trying to get the following C code to work in java, but i don't know how since java actually has strings.............. i know it works in C, i use it. this isnt a full program, just two functions used by my encryption algorithm.......... so yeah. any ideas on how i would do this in java?
- Code: Select all
char toch(int w) {
if (w > 9) return (w + 55);
else return (w + 48);
}
int toi(char w) {
if (w > 64) return (w - 55);
else return (w - 48);
}
int leng(char* str) {
int x;
for (x = 0; str[x] != 0; x++) {}
return x;
}
void revstr(char* str) {
char tmp;
int l = leng(str), l2 = l - 1, ong;
for (ong = 0; ong < (l / 2); ong++) {
tmp = str[ong];
str[ong] = str[l2 - ong];
str[l2 - ong] = tmp;
}
}
toi and toch (to integer / character, my atoi replacements) just use ascii codes.
leng is my strlen replacement............
and sorry for the lack of comments.


