How can I calculate the force required to contradict gravity?2d

Lets say I have an object with “RigidBody2”.
I want to apply force to it’s y axis to contradict the gravity’s force.
so that the object will hover in the same place.

how can I calculate the required force?

You don’t need to. Just set Rigidbody2D.gravityScale = 0;

I found this answer :

 var f:Vector3  = -(rigidbody.mass * rigidbody.velocity);
     rigidbody.AddForce(f, ForceMode.Impulse);
     rigidbody.AddForce(-(Physics.gravity), ForceMode.Acceleration);

How can I apply the power with nicer ease?