Originally posted by Lalit K Kumar:
hi,
try this one out.
To convert long to int :-
total =total+Integer.parseInt(String.valueOf(text));
To convert int to long :-
text =text+Long.parseLong(String.valueOf(total));
regards,
lalit
[ February 26, 2004: Message edited by: Lalit K Kumar ]
This seems like a very convoluted way to convert from one numeric type to another.
You should use the cast operators instead:
To convert from int to long:
text = text + (long)total;
To convert from long to int:
total = total + (int)text;
Another solution is to just declare both variables as the same type.