you're far more likely to get an error on this line:
byteInCP = in_var_1[i].getBytes("CP1251");
There's no guard against in_var_1[i] being null. There's no guard against the getBytes() method returning more bytes than will fit inside the target array.
String temp=new String(byteInCP);
This might give an error, IF the result of your getBytes() call caused the array to be filled with something that the JVM can't turn into a String.
When that happens, the result is not specified by the API documentation. It might be an exception, it might be an empty String, it might be a String filled with garbage.
And you don't guard against any of that, just assume it will always work...
I am trying to covert utf-8 encoding into CP1251 encoding. But i am getting null pointer exception.
That isn't even possible with the code you posted. There is no main method so you can't run that class and there is no code that creates an instance of that class or calls any methods in it.
You have to post the code you want help with.
If you were getting that exception there would be a console message showing the exact message and likely a stacktrace showing just how the exception arose.
But you have posted NO such actual exception.
You can easily set step through the code using the debugger in your NetBeans, Eclipse, JDeveloper or other IDE to see what the variable values are and examine each line of code as it executes.