code: public static int[] validate2(int[] data, boolean allowSz1, String paramName){
          if(data == null) {
              return null;
          }
  
  
          if(allowSz1){
              Preconditions.checkArgument(data.length == 1 || data.length == 2,
                      "Need either 1 or 2 %s values, got %s values: %s",
                      paramName, data.length, data);
          } else {
              Preconditions.checkArgument(data.length == 2,"Need 2 %s values, got %s values: %s",
                      paramName, data.length, data);
          }
  
          if(data.length == 1){
              return new int[]{data[0], data[0]};
          } else {
              return data;
          }
      }
docs: Reformats the input array to a length 2 array.
  
  If the array is length 1, returns [a, a]
  If the array is length 2, returns the array.
  
  @param data An array
  @param paramName The param name, for error reporting
  @return An int array of length 2 that represents the input