CharsetEncoder averageBytesPerChar() method in Java with Examples
The averageBytesPerChar() method is a built-in method of the java.nio.charset.CharsetEncoder which returns the average number of bytes that will be produced for each character of input which is provided. The heuristic value thus is used to estimate the size of the output buffer required for a given input sequence.
public final float averageBytesPerChar()
Parameters: The function does not accepts any parameter.
Return Value: The function returns the average number of bytes that is produced for each character of input.
Below is the implementation of the above function: