How to make Java codes FRC neo brushed motor electrical locking"
By lock, do you mean brake mode?
In any case, you should refer to the documentation for the controller (SPARK MAX).
If you are referring to brake mode, this should provide a good start point:
Thank you for your answer