public static int [ ] validate3 ( int [ ] data , String paramName ) { if ( data == null ) { return null ; } Preconditions . checkArgument ( data . length == 1 || data . length == 3 , "Need either 1 or 3 %s values, got %s values: %s" , paramName , data . length , data ) ; if ( data . length == 1 ) { return new int [ ] { data [ 0 ] , data [ 0 ] , data [ 0 ] } ; } else { return data ; } }
Reformats the input array to a length 3 array .