SHARE
TWEET

Untitled

advictoriam Jan 18th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Numbers
  2. {
  3.    /**
  4.       Produces a string containing the numbers in an array,
  5.       separated by commas, such as "1,4,9"
  6.       @param values an array of integer values
  7.       @return a string containing the array elements, separated by
  8.       commas.
  9.     */
  10.    public String separateWithCommas(int[] values)
  11.    {
  12.       String str = "";
  13.       for(int a : values){str += a + ",";}
  14.       return (str.length() != 0) ? str.substring(0, str.length() - 1) : "";
  15.    }
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top