Java Top

The early-bird price of the new Learn Spring Security OAuth course packages will increase by $50 on Wednesday:

>> CHECK OUT THE COURSE

The method copyValueOf() converts a character array to a String with the same contents. This method is equivalent to valueOf(char[]).

The offset represents the index of the first element to start copying from, and the count represents the number of elements to copy.

Available Signatures

public static String copyValueOf(char[] data)
public static String copyValueOf(char[] data, int offset, int count)

Example

@Test
public void whenCallCopyValueOf_thenStringConstructed() {
    char[] array = new char[] { 'a', 'b', 'c', 'd' };
    
    assertEquals("abcd", String.copyValueOf(array));
}
Next »
Java String.endsWith()
« Previous
Java String.contains()
Java bottom

The early-bird price of the new Learn Spring Security OAuth course packages will increase by $50 on Wednesday:

>> CHECK OUT THE COURSE
Comments are closed on this article!