<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>fumokmm</author_name>
  <author_url>https://blog.hatena.ne.jp/fumokmm/</author_url>
  <blog_title>No Programming, No Life</blog_title>
  <blog_url>https://npnl.hatenablog.jp/</blog_url>
  <categories>
    <anon>アルゴリズム</anon>
    <anon>Java</anon>
    <anon>Groovy</anon>
    <anon>Tips</anon>
  </categories>
  <description>ある変数の値がマイナスを許容しないような場合があるとして、他の変数から値を受け取って設定するような場合を考えてみる。(Javaにて) 普通に書くと int num1; if (a &lt; 0) { num1 = 0; } else { num1 = a } こんな感じだろうか。もしくは三項演算子を利用して int num1 = (a &lt; 0) ? 0 : a; となるだろう。 max, minを使うと？ そして、java.util.Math#max()を利用する書き方はこんな感じになる。 int num1 = java.util.Math.max( a, 0 ); いかがでしょうか。aが0以上の場…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fnpnl.hatenablog.jp%2Fentry%2F20090212%2F1234455289&quot; title=&quot;最小値や最大値をmax, minで表現する - No Programming, No Life&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2009-02-12 01:14:49</published>
  <title>最小値や最大値をmax, minで表現する</title>
  <type>rich</type>
  <url>https://npnl.hatenablog.jp/entry/20090212/1234455289</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
