Java Integer Array to String intsToString(int[] b)

Here you can find the source of intsToString(int[] b)

Description

Prints a int[] as a string separated by ".", if the string is to short the default is "0.0.0.0"

License

LGPL

Parameter

Parameter Description
b int[] to print the first four indexes of.

Return

The formatted string or default value.

Declaration

public static String intsToString(int[] b) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    /**/*from w  w w.  j  a  v  a 2 s  . c  o m*/
     * Prints a int[] as a string separated by ".", if the string is to short
     * the default is "0.0.0.0"
     *
     * @param b int[] to print the first four indexes of.
     * @return The formatted string or default value.
     */
    public static String intsToString(int[] b) {
        if (b.length < 4) {
            return "0.0.0.0";
        }
        return String.format("%d.%d.%d.%d", b[0], b[1], b[2], b[3]);
    }
}

Related

  1. intArrayToString(int[] ints)
  2. intArrayToString(String tag, int[] arr)
  3. intArrayToStringArray(int[] ids)
  4. intsToString(int ints[])
  5. intsToString(int[] ary)
  6. intsToStrings(final int... numbers)
  7. intsToStrings(int[] intreps)
  8. toTextString(int[] array)