public static float wrap(float value){
  if (value >= 0.f) {
    return value - (int)value;
  }
  float wrappedValue=value - (float)Math.floor(value);
  if (wrappedValue >= 1.f) {
    wrappedValue-=1.f;
  }
  return wrappedValue;
}

public static float wrap ( float value ) { if ( value >= 0.f ) { return value - ( int ) value ; } float wrappedValue = value - ( float ) Math . floor ( value ) ; if ( wrappedValue >= 1.f ) { wrappedValue -= 1.f ; } return wrappedValue ; }
wrap the value to the range [ 0 . . 1 [ ( 1 is excluded ) . e . g . value = = 4 . 0 - > return 0 . 0 value = = 4 . 1 - > return 0 . 1 value = = 4 . 9 - > return 0 . 9 value = = - 4 . 0 - > return 0 . 0 value = = - 4 . 1 - > return 0 . 9 ( and not 0 . 1 ) value = = - 4 . 9 - > return 0 . 1 ( and not 0 . 9 )
