how would i increment numbers?

so i want to have it where i push on a key and it takes a number and increments it, and when i let off the key the number decrements back down to zero. any ideas or way i could go about doing this in java?

The simplest way is to increment the value in GetKeyDown and decrement it in GetKeyUp. Supposing that number is the variable where the number is stored and the key C increments/decrements the value, the code could be something like this:

var number: int = 1;

function Update(){
  if (Input.GetKeyDown("c")){
    number += 1;
  }
  if (Input.GetKeyUp("c")){
    number -= 1;
  }
}