Converting an int array to a String array

int[] nums = {5,1,2,11,3}; //List or Vector Arrays.sort(nums); //Collections.sort() for List,Vector String a=Arrays.toString(nums); //toString the List or Vector String ar[]=a.substring(1,a.length()-1).split(“, “); System.out.println(Arrays.toString(ar)); UPDATE: A shorter version: int[] nums = {-5,1,2,11,3}; Arrays.sort(nums); String[] a=Arrays.toString(nums).split(“[\\[\\]]”)[1].split(“, “); System.out.println(Arrays.toString(a));

What is the differences between Int and Integer in Scala?

“What are the differences between Integer and Int?” Integer is just an alias for java.lang.Integer. Int is the Scala integer with the extra capabilities. Looking in Predef.scala you can see this the alias: /** @deprecated use <code>java.lang.Integer</code> instead */ @deprecated type Integer = java.lang.Integer However, there is an implicit conversion from Int to java.lang.Integer if … Read more

Using int vs Integer

the Integer class is provided so that values can be boxed/unboxed in a pure OO manner. use int where appropriate unless you specifically need to use it in an OO way; in which case Integer is appropriate. Java Int vs Integer However, very different things are going on under the covers here. An int is … Read more

How do I convert a decimal to an int in C#?

Use Convert.ToInt32 from mscorlib as in decimal value = 3.14m; int n = Convert.ToInt32(value); See MSDN. You can also use Decimal.ToInt32. Again, see MSDN. Finally, you can do a direct cast as in decimal value = 3.14m; int n = (int) value; which uses the explicit cast operator. See MSDN.