Java Base Encode toBase10(int[] arr)

Here you can find the source of toBase10(int[] arr)

Description

to Base

License

Apache License

Declaration

public static String toBase10(int[] arr) 

Method Source Code

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

public class Main {
    public static String toBase10(int[] arr) {

        if (arr == null) {
            return "";
        }// w  ww. j ava 2s  . c  om

        StringBuffer sb = new StringBuffer();

        for (int i = 0; i < arr.length; i++) {
            sb.append((arr[i]));

            if (i < arr.length - 1) {
                sb.append(" ");
            }
        }

        return sb.toString();
    }

    /**
     * Converts an int array to string.  
     * Note: this method does not validate that int values map
     * to valid characters
     * 
     * @param arr
     * @return
     */
    public static String toString(int[] arr) {

        if (arr == null) {
            return "";
        }

        StringBuffer sb = new StringBuffer();

        for (int anArr : arr) {
            sb.append((char) anArr);
        }

        return sb.toString();
    }
}

Related

  1. toBase(long startMillis, long currentMillis, long baseMillis)
  2. toBase10(final String base62)
  3. toBase10(int[] arr)
  4. toBase10SuffixedString(long n)
  5. toBase16(byte[] data)
  6. toBase16(int[] arr)
  7. ToBase16(StringBuilder str, byte[] data)