(Kasu Nai) wrote:
> I have an array (type char). I need to populate the last row
> (containing 10 columns) in this array with some values. Unfortunately
> the values are returned from a method as an integer.
You seem to have something wrong, then.
A "char" in Java is something very different from a "Char" in C or
C++. A Java char is a unicode value representing a printable character
in any of the written languages supported by unicode.
Perhaps you meant to have a "byte" array? A Java "byte" is essentially
the same as a "signed char" in C or C++: an integer in the range of
-128 to +127.
Or, if you need more bits, you can have a "short" array. For most
cases, though, you can simply get by with an "int" array.
> I keep getting "loss of precision" error. Please provide any input
> you may have.
You will get "loss of precision" whenever you stuff an int into a
smaller data type. You can get around that by casting, which tells the
compiler that you realize that you're losing precision and that you
don't care.