java matrices how to use double : 
this is the code that i made for array...

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-html -->

    public class main
    {
      public static int arraySum(int[] arr)
      {
        int result = 0;
        for (int i = 0; i < arr.length; i++)
        {
          result += arr[i];
        }
        return result;
      }
      public static int arraySumBetter(int [] a)
      {
        int result = 0;
        for (int value : a)
        {
          result += value;
        }
        return result;
      }
        
      public static void main(String [] args)
      {
        int[] a ={1,2,3,4,48};
        System.out.println(arraySum(a));
        System.out.println(arraySumBetter(a));
      }
    }

<!-- end snippet -->

after i runned it it prints

58

58

but i wanted the result as 58.0
so i changed all the `int` into `double`


but it says...

typed.java:8: error: incompatible types: possible lossy conversion from double to int
      result += arr[i];
                    ^
typed.java:19: error: incompatible types: possible lossy conversion from double to int
    return result;
           ^
2 errors

this

Do i need to add more codes? or something else?
I would appreciate if you give me some tips thanks.



`P.S I am Korean so my English is not that good i hope you guys understand me` thanks..