title: Read values wrapped in Hadoop ArrayWritable
body: <p>I am new to Hadoop and Java. My mapper outputs text and Arraywritable. I having trouble to read ArrayWritable values. Unbale to cast .get() values to integer. Mapper and reducer code are attached. Can someone please help me to correct my reducer code in order to read ArrayWritable values?</p>
  
  <pre><code>public static class Temp2Mapper extends Mapper&lt;LongWritable, Text, Text, ArrayWritable&gt;{
      private static final int MISSING=9999;
  
      @Override public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException{
          String line = value.toString();
          String date = line.substring(07,14);
          int maxTemp,minTemp,avgTemp;
  
          IntArrayWritable carrier = new IntArrayWritable();
          IntWritable innercarrier[] = new IntWritable[3];
          maxTemp=Integer.parseInt(line.substring(39,45));
          minTemp=Integer.parseInt(line.substring(47,53));
          avgTemp=Integer.parseInt(line.substring(63,69));
          if (maxTemp!= MISSING)
          innercarrier[0]=new IntWritable(maxTemp); // maximum Temperature
          if (minTemp!= MISSING)
          innercarrier[1]=new IntWritable(minTemp); //minimum temperature
          if (avgTemp!= MISSING)
          innercarrier[2]=new IntWritable(avgTemp); // average temperature of 24 hours
  
          carrier.set(innercarrier);
          context.write(new Text(date), carrier); // Output Text and ArrayWritable
          }
  }
  
  public static class Temp2Reducer
  extends Reducer&lt;Text, ArrayWritable, Text, IntWritable&gt;{
  @Override public void reduce(Text key, Iterable&lt;ArrayWritable&gt; values, Context context ) 
              throws IOException, InterruptedException {
  
            int max = Integer.MIN_VALUE;
            int[] arr= new int[3];
  
            for (ArrayWritable val : values) {
                arr = (Int) val.get(); // Error: cannot cast Writable to int
                max = Math.max(max, arr[0]);
            }
  
            context.write( key, new IntWritable(max) );
          }
  
  }
  </code></pre>